Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
(copied from CGI::Session's Cookbook Tutorial.pm)

...associate the $session object with that of HTML::Template:

$template = new HTML::Template(filename=>"some.tmpl", associate=>$session );

Now in your ``some.tmpl'' template you can access the above history like so:

<!-- left menu starts --> <table width="170"> <tr> <th> last visited pages </th> </tr> <TMPL_LOOP NAME=HISTORY> <tr> <td> <a href="<TMPL_VAR NAME=LINK>"> <TMPL_VAR NAME=TITLE> </a> </td> </tr> </TMPL_LOOP> </table> <!-- left menu ends -->

Please, observe that the same hash ref. ($session object) is applied directly in the HT since it's structure is the same. So you could mention the same hash keys in the template (see the LOOP NAME)

I have also found out that CGI::Application has some special functions reserved for HT in this same fashion (and you don't need to declare HT in it).

Refering to the place of the templates, I have discovered that CGI::Framework (similar to CA) needs to name the template's extensions as .html. In this case, you wouldn't be able to mix templates with html files in the same directory. So, having them outside the reach of your server is clever: because you don't have to change the servers' extensions to prevent opening a template instead of a normal html file.

With all these 'canned' programming experience of the mentioned modules, it is easy to become a famous webmaster in a few months!


In reply to Re: Re: Organizational strategies when using HTML::Template by chanio
in thread Organizational strategies when using HTML::Template by Hagbone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-23 15:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found