FW: [PHP] Trying to create a site-template system.. and..
| From: | Ryan Christensen | Date: | Sun, 28 Oct 2001 20:31:20 +0000 |
| Subject: | FW: [PHP] Trying to create a site-template system.. and.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72635@lists.php.net to get a copy of this message | ||
Just a refresher.. I never got any feedback on this, and would
appreciate any input anyone has.
Thanks!
Ryan
> -----Original Message-----
> From: Ryan Christensen [mailto:ryan@olypen.com]
> Sent: Friday, October 26, 2001 6:03 PM
> To: php-general@lists.php.net
> Subject: [PHP] Trying to create a site-template system.. and..
>
>
> First.. here's the synopsis of what I'm trying to do:
>
> I'm working on a site where everything is based off a really
> simple template system I'm using, see the chunk of my index
> page that deals with the plates for example:
>
> ---------------------------------------------
> $tmpl_file = fopen ("./template.htm", "r");
> $tmpl = fread($tmpl_file,16000);
> $tmpl = str_replace("{title}", "$title", $tmpl);
> $tmpl = str_replace("{header}", "$header", $tmpl);
> $tmpl = str_replace("{header_url}", "$header_url", $tmpl);
> $tmpl = str_replace("{header_home}", "$header_home", $tmpl);
> $tmpl = str_replace("{header_cat}", "$header_cat", $tmpl);
> $tmpl = str_replace("{header_caturl}", "$header_caturl",
> $tmpl); $tmpl = str_replace("{header_title}",
> "$header_title", $tmpl); $tmpl = str_replace("{pretext}",
> "$pretext", $tmpl); $tmpl = str_replace("{content}",
> "$content", $tmpl); $tmpl = str_replace("{content_source}",
> $page_source, $tmpl);
>
> eval("echo \$tmpl;");
> ---------------------------------------------
>
> The template file looks like "blah.. blah.. {title}.." the
> code above then takes the {blah} tags, and turns them into
> variables, which are defined in the actual content pages
> (which are included (via an include(); function..)
>
> The content files appear as:
>
> ---------------------------------------------
> $title = "testing";
> $content = "etc";
> ---------------------------------------------
>
> And so on..
>
> My problem is.. that when I do something like
>
> ---------------------------------------------
> $content = show_source("/path/to/file");
> // or
> $content = "Blah.. blah.. ".include("/some/file").".. some
> more blah..";
> ---------------------------------------------
>
> It includes the files (or executes the code that is assigned
> to the variable), however it all appears OUTSIDE the
> template. To see what I'm saying, see
> http://olypen.com/ryan/go/main/news or
http://olypen.com/ryan/go/source/source_index
.. that will give you a
better idea as to what I'm saying.
Anyone have any thoughts/explanations as to why this is happening? I can
provide more source.. or info if needed.
Thanks in advance!
-Ryan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net To
contact the list administrators, e-mail: php-list-admin@lists.php.net