2008/05/12

The Labs.Com Programmer HTML ProgrammerHTML Webtree
Last update 1999/08/28
The Labs - Design & Functionality For The Net

Programmer HTML Webtree

ProgrammerHTML Webtree
1. Introduction

Webtree is a built-in feature of ProgrammerHTML which allows you to define a logical tree of your site, and the structure-variables will be available within your plugin tags written in Perl.

ProgrammerHTML Webtree
2. How To Use

You can name the file structure which can look like this:

 # --- this is a sample webtree-structure file 
 index.phtml { 
    cookbook.phtml 
    plugins.phtml 
    webtree.phtml { 
       another-file.phtml 
       etc.phtml 
    } 
 } 

Instead to call phtml with files, just call it like

 % phtml -webtree structure 

Following variables you can use within <def>-tag when you use plugin=inline language=perl.

$child{$p}comma separated sub-links, .phtml or .html as defined in structure-files. $p = 'root' top-most node
$parent{$p}comma separated up-links
$next{$p}link to next page (if one exists)
$prev{$p}link to previous page (if one exists)
$title{$p}gives you the html-title of the page, maybe you need to run phtml twice as the first past .html may not exist yet
$link{$p}gives the html-link of the .phtml page

Within your def-tags you can use this as example:

    ... 
    foreach my $c (split(/,/,$child{'index.phtml'})) { 
       # --- $c is the xyz.phtml of the top-level 
       print "<p><a href=\"$link{$c}\">$title{$c}</a>\n"; 
    } 
    ... 

If you have no frontpage, but then use $child{'root'} for the first-level nodes of the tree.

With a simple traverse-function (walking through $child{..} recursively) you can walk through the entire tree, and as example, create pull-down menus as this site uses on the left-side.

                                                                                                                                   

Cookbook Programmer HTMLPlugins

Last update 1999/08/28

All Rights Reserved - (C) 1997 - 2008 by The Labs.Com

Top of Page

The Labs.Com