Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Templating Systems

by markexpjp (Novice)
on Jul 15, 2003 at 10:37 UTC ( [id://274350]=perlquestion: print w/replies, xml ) Need Help??

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

I want to use an HTML templating system... for more than just a photo album home page, so it needs to be extensible and flexible. There are heaps available. I like the look of dTemplate (http://hacks.dlux.hu/dTemplate/), and CGI::FastTemplate (CPAN).

Does anyone have experience with these or any other templating systems? Are there any I should avoid? Are there any you recommend? Of course, I am going to read the documentation, but I would like to know your thoughts if you have some practical experience with anything. I really need it to be extensible and as flexible as possible.
10POKE53280,A:POKE53281,A
20?"C64 RULES ";
30A=A+1:IFA=16THENA=0:GOTO10

Replies are listed 'Best First'.
Re: Templating Systems
by bart (Canon) on Jul 15, 2003 at 10:43 UTC
Re: Templating Systems
by tomhukins (Curate) on Jul 15, 2003 at 11:04 UTC
Re: Templating Systems
by adrianh (Chancellor) on Jul 15, 2003 at 10:41 UTC
(OT) Re: Templating Systems
by rob_au (Abbot) on Jul 15, 2003 at 13:00 UTC
    Your signature ...

    10POKE53280,A:POKE53281,A 20?"C64 RULES "; 30A=A+1:IFA=16THENA=0:GOTO10

    Tragically, I remember too much from my time on the Commodore 64 - These memory locations on the Commodore 64 controlled the background and border screen colours. Although there is no need to roll the value of A back to zero when you hit 16 as only the low nibble of these registers are interpreted (although you would still need to do so when the value of A hit 256) - The colour of the text and cursor could similarly be controlled by poke-ing similar values into memory location 646 (the memory is a little rusty on this one).

    And of course, the ? is simply shorthand for the PRINT key word - Note however that this differs from the shorthand for PRINT# for printing to output channels which is P<shift-R> - This is because PRINT# is interpreted as a separate and unique token by the interpreter. Entering the combination of ?# generates a syntax error ...

    Shoot me now ... please ... :-)

     

    perl -le 'print+unpack"N",pack"B32","00000000000000000000001001110001"'

      Ahh yes, I use VICE regularly (not for programming of course! For games silly.). 646 is the correct location for changing the cursor colour, although this doesn't work as desired when you poke character codes directly to screen memory, but it does work when you use the print statement, so you could use it here. Yes yes, you can roll it back at 256, hehee, and sometimes you would just put 64 or 128 for the hell of it. Talk about tragic... Ok... I still have all the old manuals and the basic programming manual. Never did learn assembly for it though, my parents wouldn't buy the book for me. Do you like how I spent time to get the colours looking semi sort of authentic like... Yes, it is time to shoot me now too.
      10POKE53280,A:POKE53281,A
      20?"C64 RULES ";
      30A=A+1:IFA=16THENA=0:GOTO10
Re: Templating Systems
by gellyfish (Monsignor) on Jul 15, 2003 at 11:06 UTC
      THANK YOU to all who replied. I did try searching, but I forgot about super search. $gratitude->print('Thanks' x 1000).
      10POKE53280,A:POKE53281,A
      20?"C64 RULES ";
      30A=A+1:IFA=16THENA=0:GOTO10
Re: Templating Systems
by dws (Chancellor) on Jul 15, 2003 at 15:59 UTC
    I want to use an HTML templating system... for more than just a photo album home page, so it needs to be extensible and flexible.

    If you're doing all of the work yourself, Template-Toolkit is quite powerful.

    If there's any chance that non-programmers will be working on your templates, you might want to consider HTML::Template. It's less flexible, but quite adequate, and the templates are easy (or at least relatively more easy) for non-programmers to work within.

Re: Templating Systems
by nite_man (Deacon) on Jul 15, 2003 at 11:09 UTC

    I use Embperl instead of some template system. It's simply and flexible tool.

    Also, I work sometimes with Mason. In my opinion, it's the best choise for building web applications. There are many features in the Mason. Just try to look at documentation. My favorite pure Perl software - Request Tracker has web interface which was developed on Mason.

          
    --------------------------------
    SV* sv_bless(SV* sv, HV* stash);
    
      Thanks for your input. I did consider this, and I always think about it, but it really comes down to design philosophy. There are numerous ways to accomplish anything. The reason I don't want to use Mason is that I really really like the idea of separating code and HTML, although, in a sense, template placeholders are code also. I havn't really looked that closely at the documentation for Mason, and I know I should. Thanks for your opinion.

      10POKE53280,A:POKE53281,A
      20?"C64 RULES ";
      30A=A+1:IFA=16THENA=0:GOTO10

        I'm agree with you. It's right conseption to separate code and HTML. But, I think, generally, it's the same to use operators of pseudo-language of template or Perl. In both cases you have code in your html page.

        Implement all logic of your application in the Modules (Classes) and just call methods for retriving some data and display in specified place.

        I don't agitate for Mason or Embperl. I'd like to tell you that those tools useful, power and flexible. You should just look at them more intent. ;-)

        Update: How about performance? In case with template system, you will have two processes of your data for building HTML page: preparetion template data and processing your template.

              
        --------------------------------
        SV* sv_bless(SV* sv, HV* stash);
        

        I personally feel that HTML::Template does the best job of this. While there is some "code" in the template it is more just variable placeholders and some simple boolean logic. There is no real logic or processing power. Which is great because the pretty picture designer guy can figure it out :)

        Lobster Aliens Are attacking the world!
        The reason I don't want to use Mason is that I really really like the idea of separating code and HTML

        Mason allows this but does not require it. There are numerous options for how to organize your code in a Mason site, including the following:

        <html> <head><title><% $title %></title</head> <body> <h1>Welcome to <% $sitename %>!</h1> <p>Our product of the day is <% $daily_product %>.</p> </body> </html> <%init> my $sitename = "Spuds.com"; my $title = "Spuds Home Page"; my $daily_product = get_daily_product(); </%init>

        This doesn't seem to be significantly more confusing than an HTML::Template would be, even for the "pretty picture designer guy" -- they just stay away from the %init block.

        Although you may not need them at first, Mason also has a bunch of additional features that might prove useful at some time in the future... It's powerful enough to support large public sites.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found