Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: html template in a perl script

by benrwebb (Scribe)
on Sep 23, 2003 at 20:01 UTC ( #293655=note: print w/replies, xml ) Need Help??

in reply to html template in a perl script

I'm sure what you are doing will work great for you, but I'm wondering how you are managing with only one template per page? I know that many have said this so far, but let me give you a more detailed account of why we are all questioning your use of only one template.

On any given page I actually load at least 4 templates. One for the top, one for the bottom, one for the left side menu, and one for the main part of the application. If I have an administrative block (for instance, the posting portion of a news page) then a fifth may load for that(depending, of course, on the currently logged in user). The only way I could see managing my site with a template in a DATA section would be to include the top, bottom and left menu templates, and then put the actual "application" info into the data section. I would genuinely consider doing that (it is a novel idea and I rather like it) but for two things: 1- I totally switch my display for errors(I have a template that gets called in place of everything else for error reporting) and 2- I have a team working on my site so I'm afraid that it might make CVS even weirder than it already is.

Good idea though, if you can pull it off.

Replies are listed 'Best First'.
Re: Re: html template in a perl script
by archen (Pilgrim) on Sep 24, 2003 at 16:22 UTC

    I wasn't planning on making one template for EVERY script, but it does come in handy in many instnaces. For instance I have a lot of utility scripts for editing Berkeley Databases and various other things. These scripts are created as a drop in solution and can often end up just about anywhere. The HTML for these scripts never really changes. All a template really does is adds another thing to cart around with the script.

    If you're creating a dynamic page where multiple pages need to retain the same look, then sharing similar templates makes sense. I do what you do quite often with multiple parts, but usually I use server side includes to call perl content. I'm pretty picky on performance, so I often find it's better to have cron run scripts to generate "static" content, or just have a perl script generate "static" content for each change. You can slightly improve security by this method by moving scripts out of harms (hackers) way.

    I've never been the sort of guy to make an entire website have a single look, mainly just by section so often I end up designing many more templates. Cutting these pages apart gives you flexibility, but having four template parts gets really messy when you're talking going six html tables deep and spanning multiple template files.

    This is often more of an issue with an associate of mine who isn't so CGI oriented. He has a bad habbit of seeing an html page (template) and linking that instead of the CGI script and only later looks at it and sees there's no conetent!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://293655]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2020-01-18 19:03 GMT
Find Nodes?
    Voting Booth?