Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: RFC: Proofread the POD for my HTML elements module

by Arunbear (Parson)
on Apr 20, 2013 at 11:54 UTC ( #1029637=note: print w/ replies, xml ) Need Help??


in reply to Re^2: RFC: Proofread the POD for my HTML elements module
in thread RFC: Proofread the POD for my HTML elements module

I mentioned ovid's node on HTML::Template mainly because he describes why templates should be preferred, but the exact templating module to use is less important.

I also am not a fan of HTML::Template, but I have used Template Toolkit quite a bit and found it very user friendly and versatile. I suggest giving it a try.


Comment on Re^3: RFC: Proofread the POD for my HTML elements module
Re^4: RFC: Proofread the POD for my HTML elements module
by Lady_Aleena (Chaplain) on Apr 20, 2013 at 20:57 UTC

    Arunbear, I tried TT too. Like HT, I could not get it to do what I wanted. So I came up with my own template.

    sub html { my (%opt) = @_; my $heading = textify(basename($0)) !~ /index/ ? textify(basename($0 +)) : 'My '.lc((split(/\//,cwd))[-1]); my $title = textify(join(' - ',($root_name,map(ucfirst,split(/\//,$r +elative_path))))); $title .= textify(" - $opt{heading}") if $opt{heading}; my $page_heading = $opt{heading} ? $opt{heading} : $heading; my $page_heading_id = idify($page_heading); $page_heading =~ s/_/ /g; print "content-type: text/html \n\n"; line(0,q(<!DOCTYPE html>)); line(0,q(<html>)); head(0, sub { links(1, [map {{ rel => 'stylesheet', type => 'text/css', href => +$_ }} get_styles($root_path.'/files/css')]); script(1,{ type => 'text/javascript', src => "$root_link/files/jav +ascript/list.js" }); }, { title => $title }); body(0, sub { div(1, sub { heading(2,1,'Site menu', { id => 'Site_menu' }); list(3,'u',get_menu( directory => $root_path, tab => 2, color => + 0, full => 0, ), { onclick => 'list_onclick(event)' }); link_list(3,qq($root_user off-site),%other_sites); link_list(3,qq(Reciprocated links),%reciprocated_links); }, { class => 'left' }); div(1, sub { heading(2,1,$page_heading, { id => $page_heading_id }); &{$opt{code}}; # This is where individual page contents goes. paragraph(3,"Contact $link{mail}!", { class => 'address' }); }, { class => 'right' }); }); line(0,q(</html>)); }

    It is so much easier to use then either TT or HT.

    Have a cookie and a very nice day!
    Lady Aleena
      What could you not get TT to do?

      Your solution looks somewhat like Template::Declare but much more messy.

        I know my code is a mess since I do not use blank lines in it. Usually I clean up code I post to PerlMonks, but I got lazy.

        As for TT, I could not get it to do anything right.

        Have a cookie and a very nice day!
        Lady Aleena

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-09-19 05:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls