Python Webpages

Roman Neuhauser neuhauser at mail.cz
Tue Apr 30 10:36:38 EDT 2002


> From: Tom Chance <tomchance at gmx.net>
> Subject: Re: Python Webpages
> To: python-list at python.org
> Date: Tue, 30 Apr 2002 14:46:03 +0000
> 
> Sorry if I'm coming in at a tangent to this conversation, or repeating 
> something that's been said before, but I've been using Perl and the 
> HTML::Template module for ages now and it seems to me to be the natural 
> way to do things. You basically create a series of HTML templates, and 
> put fake HTML tags into them like:
> 
> <TMPL_VAR NAME=TITLE>
> 
> And then in your perl scripts you call a new HTML::Template object, give 
>  it the values to put into all of the fake HTML tags, and tell 
> HTML::Template to print out the page, like so:
> 
> use HTML::Template;
> my $template = HTML::Template->new(filename => 'template.html');
> $template->param(TITLE => 'Hello there!');
> print $template->output();
> 
> This lets you keep the HTML seperate from the logic of the script 
> (something which I find preferable to PHP's system, especially if the 
> script is vey complicated), 

    Pardon me, but what's the PHP's system? Perhaps Smarty:

    require("Smarty.class.php");
    $smarty = new Smarty;
    $smarty->assign("Title","My Homepage");
    $smarty->assign("Names",array("John","Gary","Gregg","James"));
    $smarty->display("index.tpl");

    I always thought Perl's system was

    print "Content-Type: text/html\n\n";
    print "<html><body>Hello world!</body></body>\n";

-- 
FreeBSD 4.4-STABLE
4:20PM up 1 day, 6:46, 11 users, load averages: 0.00, 0.03, 0.01





More information about the Python-list mailing list