Jump to content


Photo

Search and replace with includes


  • Please log in to reply
2 replies to this topic

#1 YorkshireSteve

YorkshireSteve
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 06 April 2006 - 11:41 AM

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

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 06 April 2006 - 12:38 PM

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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 YorkshireSteve

YorkshireSteve
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 06 April 2006 - 02:06 PM

[!--quoteo(post=362197:date=Apr 6 2006, 01:38 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Apr 6 2006, 01:38 PM) View Post[/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users