templated these macros

This commit is contained in:
JT Smith 2004-07-10 05:36:05 +00:00
parent 7648c6c13f
commit 577554b904
7 changed files with 110 additions and 38 deletions

View file

@ -38,6 +38,7 @@ This package contains utility methods for WebGUI's template system.
use WebGUI::Template;
$hashRef = WebGUI::Template::get($templateId, $namespace);
$hashRef = WebGUI::Template::getList($namespace);
$templateId = WebGUI::Template::getIdByName($name,$namespace);
$html = WebGUI::Template::process($templateId, $namespace, $vars);
$templateId = WebGUI::Template::set(\%data);
@ -134,6 +135,35 @@ sub getList {
}
#-------------------------------------------------------------------
=head2 getIdByName ( name, namespace ) {
Returns a template ID by looking up the name for it.
=over
=item name
The name to look up.
=item namespace
The namespace to focus on when searching.
=back
=cut
sub getIdByName {
my $name = shift;
my $namespace = shift;
my ($templateId) = WebGUI::SQL->quickArray("select templateId from template where namespace=".quote($namespace)." and name=".quote($name),WebGUI::SQL->getSlave);
return $templateId;
}
#-------------------------------------------------------------------
=head2 process ( templateId, namespace, vars )