[Petal] petal include: modifier
Simon McCaughey
simonmcc at nortelnetworks.com
Fri Jan 14 00:23:23 GMT 2005
[Petal] petal include: modifierIs there any significant overhead associated with this method?
Is it basically the same as doing a static metal include? I suppose there must be some more overhead, an extra Petal->new call, and an extra ->process() call too
Thanks
Simon
PS thanks for the code :)
----- Original Message -----
From: Warren Smith
To: Petal Mailing List
Sent: Thursday, January 13, 2005 11:37 PM
Subject: [Petal] petal include: modifier
This is very simple, and allows you to do something like this
given {
template => 'content.html'
}
you can do
<html>
<div petal:content="structure include: ${template}" />
</html>
and content.html will be included in your main site.
And as everybody knows, there is always more than one way to do it, but
this worked for me.
package Petal::Hash::Include;
use strict;
use warnings;
use base qw/Petal::Hash::String/;
sub process {
my ($self, $hash, $args) = @_;
my $fn = $self->SUPER::process($hash, $args);
my $tpl = Petal->new($fn);
return $tpl->process($hash);
}
1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webarch.co.uk/pipermail/petal/attachments/20050114/472ab83d/attachment.htm
More information about the Petal
mailing list