Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Using a template

by shanestyle (Initiate)
on Mar 14, 2003 at 16:31 UTC ( [id://243107]=perlquestion: print w/replies, xml ) Need Help??

shanestyle has asked for the wisdom of the Perl Monks concerning the following question:

I am using PERL as CGI to suck content into a template. Simple enough. Some of the content that I need to grab is from other departments, meaning they want to slip their navigation into my template's navigation. The template is set up to use a left navigation, so their navigation would be insterted under the link used to get to their department.

I am pretty new to PERL. Is there a way to have a config file that is read everytime a link is clicked, and if the link includes a certain var, then the config file would know to also grab navigation as well as content. Or am I making this to complicated? My usual tool is PHP, so the transition is not too bad, but I am not sure how to accomplish this.

Thanks.

Replies are listed 'Best First'.
Re: Using a template
by gryphon (Abbot) on Mar 14, 2003 at 16:39 UTC

    Greetings shanestyle,

    Simple answer: You could require your settings file from your Perl CGI script. First, create a settings.pl file. Insert into that file whatever settings, subs, whatever that are shared by your various CGI scripts. Then require settings.pl; from each of your CGI scripts. require is not exactly the same as use, so read a bit in the docs about require for additional info.

    Better answer: Take a look at HTML::Template. It sounds like your situation may be really helped by that. Without knowing more specifics about your situation, I can't answer more directly. However, I can tell you that after having adopted HTML::Template, I can't code any other way.

    gryphon
    code('Perl') || die;

Re: Using a template
by perrin (Chancellor) on Mar 14, 2003 at 17:38 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://243107]
Approved by blokhead
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found