|
HTML::EasyTemplate::DirMenu - HTML menus of directories. |
HTML::EasyTemplate::DirMenu - HTML menus of directories.
Provide an easy means of creating from a directory a representative block of HTML suitable for use as a substitution item in an HTML::Easytemplate, or as freestanding mark-up.
Print a simple menu of HTML files in current working directory:
use HTML::EasyTemplate;
my $m = new HTML::EasyTemplate::DirMenu (
'START' => 'E:/www/leegoddard_com',
'URL_ROOT' => 'http://leegoddard_com',
'MODE' => 'files',
'TITLE_FROM' => 'title',
'LIST_START' => '<DIV class="menu-layer">',
'LIST_END' => '</DIV>',
'ARTICLE_START' => '<DIV class="menu-item">',
'ARTICLE_END' => '</DIV>',
'DIR_START' => '<DIV class="dir-name>',
'DIR_END' => '</DIV>',
);
print $m->{HTML};
Add the following lines to the above for a menu in an HTML::EasyTemplate, as TEMPLATEITEM name='menu1' (based on the example provided in HTML::EasyTemplate):
use HTML::EasyTemplate::DirMenu;
my %items = (
'articleTitle'=> 'An Example Article',
'articleText' => 'This is boring sample text: hello world...',
'menu' => $m->{HTML},
);
my $TEMPLATE = new HTML::EasyTemplate('E:/WWW/leegoddard_com/FL/_templates/Template_Blank.html') or die "Couldn't make template!";
$TEMPLATE->title("Latka Lover");
$TEMPLATE -> process('fill',\%items);
$TEMPLATE -> save( 'E:/WWW/leegoddard_com/FL/','new2.html');
print "Saved the new document as <$TEMPLATE->{ARTICLE_PATH}>\n";
__END__
EasyTemplate;
cwd;
HTML::TokeParser;
strict;
The method expects a package/class referemnce as it's first parameter. Following that, arguments should be passed in the form of an anonymous hash or as name/value pairs:
my $m = new HTML::EasyTemplate::DirMenu (
'arg1'=>'val1','arg2'=>'val2',
);
or:
my $m = new HTML::EasyTemplate::DirMenu (
{'arg1'=>'val1','arg2'=>'val2',}
);
m/\.($HERE)$/i
Deafults to .*\.html?.
EXTENSIONS slot above, be included or excluded in the printing of a filename. Defaults to exclude.
[No content].
The ARTICLE_ROOT is stripped from filepaths when creating HTML A href elements, and replaced with...
URL_ROOT.
&new) to output maybe a drop-down menu.
Collects content info of a directory, the path to which it accepts as it's sole argument.
Returns undef on failure.
Fills the calling object's HTML slot detailed in the constructor method's documentation.
Incidentaly returns that HTML.
RECURSE='false'>, directories will displayed as if they were files. This may change.
HTML::TokeParser
HTML::EasyTemplate
HTML::EasyTemplate::PageMenu
HTML::EasyTemplate::BuildMySite
Lee Goddard (LGoddard@CPAN.org)
Copyright 2000-2001 Lee Goddard.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
HTML::EasyTemplate::DirMenu - HTML menus of directories. |