|
|
Choosing A Webhost: |
Re: H::T future: msg#00025lang.perl.modules.html-template
Lance A. Brown wrote: Argh. I can't remember where, but I ran across a Website package using Aha! Found it! Yapcom, the CGI::App-based application to handle registration and workshops for YAP conferences! Here is the relevant piece of code. Personally, I think this is a VERY tasty hack. It lets page designers plug parameters back into the templating system for use elsewhere. Very cool. sub _server_page { my $self = shift; my ($page) = @_; my $q = $self->query; # we allow tags like this in our templates that will define values # to be set as parameters # <TMPL_VALUE NAME="name" VALUE="value"> my %h; my $filter = sub { my $text_ref = shift; while ($$text_ref =~ s/<\s*TMPL_VALUE\s+NAME="([^"]*)"\s+VALUE="([^"]*)"\s*>//) { $h{$1} = $2; } }; my $t = $self->load_tmpl( "$page.tmpl", die_on_bad_params => 0, filter => $filter, associate => $q, path => $templates_dir, ); $t->param(%h); $t->param(VERSION => $YAPC::Organizer::VERSION); return $t; } --[Lance]
-- Carolina Spirit Quest: http://www.carolinaspiritquest.org/ Celebrate The Circle: http://www.angelfire.com/nc/celebratethecircle/ My LiveJournal: http://www.livejournal.com/users/labrown/ ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: Re: H::T future, Paulsen, Brian |
|---|---|
| Next by Date: | Re: Re: H::T future, Sam Tregar |
| Previous by Thread: | Re: Re: H::T future, Cees Hek |
| Next by Thread: | Re: Re: H::T future, Sam Tregar |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |