Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-01-11 14:12:25

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 106
Website

Save textpattern´s output into file

This may sound a bit weird but for combining textpattern with my favorite shopping system it seems to me that this would be the easiest way.
I could also play around with

file_get_contents

But this would have other drawbacks I do not want to dive into at this point.

I usually use as my pages setup in textpattern something like that to be able to edit pages via my editor:

<txp:php>include 'mypage_template.php';</txp:php>

So it´s basically already pretty much excluded from textpattern.

That´s why I had the idea, what if there would be a way to have the “final generated HTML” from textpattern end up in a html oder php file that I would just need to include then via my shopping system.

I hope this problem of mine is not too abstract and you could tell me if there is an easy and/or elegant way to achieve what I am trying to do.
Basically I just need to manipulate a bit of HTML with textpattern which is then “taken” by my shopping system and put in the right places.

Offline

#2 2020-01-11 17:00:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,270
Website

Re: Save textpattern´s output into file

If I understand you correctly, what you are requesting is already possible using the stable release. Admittedly, I am still using rah_external_output as I am too lazy to go through and change the instances I am using it. I am calling the content by using. <?php echo file_get_contents('http://www.site.tld/?rah_external_output=form_name'); ?>


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Online

#3 2020-01-11 21:11:57

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 106
Website

Re: Save textpattern´s output into file

Thanks Yiannis for your reply. I have solved my problem for now, but I am not sure if it´s the nicest way performancewise.

So I would still need to use file_get_contents() to call it from within my shopping system.

I do not really understand whats the advantage then of using rah_external_output.
rah_external_output lets you just output the form via URL right? But let´s say I create a section anyway I could just

<?php echo file_get_contents('http://www.site.tld/section'); ?> 

right? At least it´s working for me now. I just always thought that file_get_contents() is a speed issue.
Am I wrong?

That´s why I thought writing the textpattern html output to a file and include that somehow would be better.

By the way: Is there a documentation somewhere of how to achieve the same with

<txp:output_form/>

Offline

#4 2020-01-12 06:29:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,270
Website

Re: Save textpattern´s output into file

demoncleaner wrote #321041:

Thanks Yiannis for your reply. I have solved my problem for now, but I am not sure if it´s the nicest way performancewise.

So I would still need to use file_get_contents() to call it from within my shopping system.

I do not really understand whats the advantage then of using rah_external_output.
rah_external_output lets you just output the form via URL right? But let´s say I create a section anyway I could just

<?php echo file_get_contents('http://www.site.tld/section'); ?>...

right? At least it´s working for me now. I just always thought that file_get_contents() is a speed issue.
Am I wrong?

That´s why I thought writing the textpattern html output to a file and include that somehow would be better.

By the way: Is there a documentation somewhere of how to achieve the same with

<txp:output_form/>...

I started using rah_output when it came out as i wanted that content to be independent from the structure of the site. Forms could do that. I’m not sure regarding the performativity and speed of file_get_contents(). Again, I’ve been using it for many years without any issues and I tend to not change things that work.

I know that Oleg posted the way to call a form which will make Jukka’s plugin redundant but I just can not find his post now.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Online

Board footer

Powered by FluxBB