Date: 01/04/01
- Next message: RTM: "RE: [phplib] Some help please !!"
- Previous message: Bertrand Mansion: "Re: Re[2]: [phplib] Re: session/session4.inc versus phplib4*"
- Next in thread: Fred Yankowski: "Re: [phplib] Inserting PHP Files using Templates"
- Reply: Fred Yankowski: "Re: [phplib] Inserting PHP Files using Templates"
- Reply: Kartic Krishnamurthy: "Re: [phplib] Inserting PHP Files using Templates"
- Maybe reply: Peter Bowyer: "Re: [phplib] Inserting PHP Files using Templates"
- Maybe reply: Brian Popp: "Re: [phplib] Inserting PHP Files using Templates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am not interested in embedding PHP in my templates. I agree that this
defeats the purpose of using templates. Instead I have a template that has
the general look and feel for my site. On that template file I have a
{content} tag that I want to replace with a sub-page. If these sub-pages
were HTML, this would work perfect. I could just:
$t->set_file ( "main", "main.ihtml" );
$t->set_file ( "sub", "news.ihtml" );
$t->parse ( "content", "sub" );
$t->parse ( "out", "main" );
Unfortunately, this is not always the case, and these sub-pages may or may
not contain PHP code. As many of you know, this will not work because PHP
isn't interpretted by the parse function. In order to work around this, I
wrote a function called http_read that opens a socket to the web server and
requests the page via http, putting the contents into a variable. Then I
just replace {content} with that variable like so:
$content = http_read ( "news.php" );
$t->set_var ( "content", $content );
This is working (www.bpopp.net), but it just doesn't SEEM like the right way
to go. It's relatively slow and I think if my server was carrying any kind
of load, this implementation would fail miserably. Using CGI (vs Apache
Module) the performance hit is even more pronounced. Does anyone have any
alternatives to this implementation?
Actually, I'm looking for ANY way to easily give my pages a consistent look
and feel without redundant HTML in 100 different files.
ANY comments are welcome and appreciated!
BPopp - www.bpopp.net
bpopp at midsouth.rr.com
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: RTM: "RE: [phplib] Some help please !!"
- Previous message: Bertrand Mansion: "Re: Re[2]: [phplib] Re: session/session4.inc versus phplib4*"
- Next in thread: Fred Yankowski: "Re: [phplib] Inserting PHP Files using Templates"
- Reply: Fred Yankowski: "Re: [phplib] Inserting PHP Files using Templates"
- Reply: Kartic Krishnamurthy: "Re: [phplib] Inserting PHP Files using Templates"
- Maybe reply: Peter Bowyer: "Re: [phplib] Inserting PHP Files using Templates"
- Maybe reply: Brian Popp: "Re: [phplib] Inserting PHP Files using Templates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

