|
HTML::EasyTemplate::PageMenu - make an HTML menus of your page. |
HTML::EasyTemplate::PageMenu - make an HTML menus of your page.
Provide an easy means of creating from a page's elements a representative block of HTML suitable for use as a substitution item in an HTML::Easytemplate, or as freestanding mark-up.
Add links to TARGET elements in HTML; print the modified doc, followed by the modified MENU:
use HTML::EasyTemplate::PageMenu;
my $m = new HTML::EasyTemplate::PageMenu (
'HTML' => 'test.html',
'TARGET' => ['H1','H2',],
);
print $m->{HTML},"\n";
print $m->{MENU},"\n";
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;
my $TEMPLATE = new HTML::EasyTemplate( $m->{HTML} );
$TEMPLATE -> process('fill', {'menu' => $m->{MENU}} );
$TEMPLATE -> save( 'E:/a/dir','new2.html');
print "Saved the document with a menu as <$TEMPLATE->{ARTICLE_PATH}>\n";
__END__
Cwd;
HTML::TokeParser;
URI::Escape;
strict;
warnings;
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::PageMenu (
'arg1'=>'val1','arg2'=>'val2',
);
or:
my $m = new HTML::EasyTemplate::PageMenu (
{'arg1'=>'val1','arg2'=>'val2',}
);
Then initiated as a public instance variable containing the modified HTML the object was called with (ie. with anchors inserted).
[H1,H2]).
Default is UL element.
Default is LI element.
Sets and returns $self-{MENU}> - a fragment of HTML that is the menu of links which refers to the anchors embedded in the page by the constructor.
Parses the document looking for elements to use as menu items: adds an anchor before each, and stores them internally for future use in building the menu.
Returns undef on failure, reference to scalar of adjusted HTML on success.
HTML::EasyTemplate?
the HTML::EasyTemplate manpage the HTML::EasyTemplate::DirMenu manpage
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::PageMenu - make an HTML menus of your page. |