Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Don't know if this is possible - Include a form in a external file
I’m not sure if this is possible, but here goes.
Is there a way to include a textpattern form in an external file with some sort of call. I am using textpattern for most of my content but there’s another CMS that is being used that just needs a header and footer file from my server passed into their system.
Is there was a way to include a form in an external page like a php include?
Last edited by ecklesroad (2008-09-08 22:35:09)
Offline
Re: Don't know if this is possible - Include a form in a external file
Forms are stored in Textpattern’s MySQL database, so you can call them by queries. But ofcourse, if there are any tags, those won’t be parsed with out including parser functions too.
Other way around is to build textpattern page (static section) that uses a template that only outputs the header or footer form. After that you can use PHP’s include functions to include the form aka section.
In example you could create a section called “header”, and set that header-section to use template that contains only <txp:output_form form="header" />
or similiar.
After that, you can use include, file_get_contents etc. including functions to include the form. In example, if you got PHP configured in a way that allow_url_fopen set on and file_get_contents isn’t blocked, then you could use file_get_content('http://mydomain.com/?s=header');
or similiar to include the section and it’s template to the other software.
Offline
Re: Don't know if this is possible - Include a form in a external file
If your form doesn’t have any <txp:
tags, you could use cnk_versioning to maintain the form as a static file to be used by both content management systems. Then you could probably use a normal php include command in your other CMS, while still using <txp:output_form
in your Textpattern pages.
Offline
Re: Don't know if this is possible - Include a form in a external file
Thanks Gocom, I got that to work:
I made two sections, a header and footer, with a header and footer page used for each.
header.php:
<?
$headerContent=file_get_contents("http://www.site.com/header");
echo $headerContent;
?>
footer.php
<?
$footerContent=file_get_contents("http://www.site.com/footer");
echo $footerContent;
?>
works like a charm, I wasn’t sure if this was possible, thanks!!!!
Offline