Jump to content

Archived

This topic is now archived and is closed to further replies.

YorkshireSteve

Search and replace with includes

Recommended Posts

Hi All,

I'm creating a basic template system for a website and have variables in the content such as [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]{{Content:Body}}[!--fontc--][/span][!--/fontc--] which would be replaced with the variable [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]$content['body'][!--fontc--][/span][!--/fontc--]. This works fine, however, I also want to replace [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]{{Component:Login_Form}}[!--fontc--][/span][!--/fontc--] with the file [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]Components/Login_Form.php[!--fontc--][/span][!--/fontc--]. I'm not having much luck with this but it's something which would be very handy not only on this project, but also on other projects in the future.

Does anyone have any ideas how this may be achieved?

Thanks,

Steve

Share this post


Link to post
Share on other sites
as long as your Login_Form component is simply an HTML form, you could use file_get_contents() to assign the content of the component to a variable and echo it out inside the template tag.

Share this post


Link to post
Share on other sites
[!--quoteo(post=362197:date=Apr 6 2006, 01:38 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Apr 6 2006, 01:38 PM) [snapback]362197[/snapback][/div][div class=\'quotemain\'][!--quotec--]
as long as your Login_Form component is simply an HTML form, you could use file_get_contents() to assign the content of the component to a variable and echo it out inside the template tag.
[/quote]
Thanks for the reply. Anything represented by [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]{{Content:xxxx}}[!--fontc--][/span][!--/fontc--] is HTML code, pulled straight from a database. Anything in the form of [!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--]{{Component:xxxx}}[!--fontc--][/span][!--/fontc--] will need to be included as this is going to be executable code (such as a poll, form (including processing) etc.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.