BigVic has asked for the wisdom of the Perl Monks concerning the following question:
php style includes look like this:
include("templates/top.html"); include("templates/left.html"); include("templates/main.html"); include("templates/bottom.html");
my perl equivalent for several templates at a time
this is a rough draft of what i'm trying to do, there might be some erros in the syntax but i'm sure you can grasp the concept. now this script is going to be called several times from a site menu with several different template options, (i'm just trying to make it simple for explantion purposes). which means that file opening and closing is going to happen very often, which will slow down the site. is there a better way of doing this? remind you, SSI is not an option, neither is CGI.pm, and no stander SQL style database is available.foreach $plate(keys %PLATES) { $TEMPLATES{$plate} = "template_folder/$plate"; if (open ($handle,"$TEMPLATES{$plate}) )<br> { $TEMPLATES{$plate} = <$handle>;<br> close ($handle);<br> } } print $TEMPLATE{'top'} print $TEMPLATE{'left'} print $TEMPLATE{'main'} print $TEMPLATE{'bottom'}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: php style includes
by chromatic (Archbishop) on Jul 03, 2001 at 01:10 UTC | |
|
Re: php style includes
by thabenksta (Pilgrim) on Jul 02, 2001 at 22:52 UTC | |
by andreychek (Parson) on Jul 02, 2001 at 23:50 UTC | |
by BigVic (Initiate) on Jul 03, 2001 at 00:21 UTC | |
by bastard (Hermit) on Jul 03, 2001 at 03:32 UTC |