HTML::TemplateZ

From Deep Thought

Jump to: navigation, search

HTML::TemplateZ

NAME

HTML::TemplateZ - HTML Template System for Cyber Sprocket's Zinc Framework

DESCRIPTION

Dynamic Z-Encoded HTML page processor and advanced HTML processing. Replaces standard Z_XXX_Z appearances within standard HTML code with the output from an equivalently named XXX perl function.

SYNOPSIS

 use HTML::TemplateZ;
 my $Template = new HTML::TemplateZ;
 $Template->ZD(FILENAME=>'myzpage.html');

REQUIRES

nothing.

METHODS

new

Create a new TemplateZ object.

Properties

        CodeStart       = the 2-character starting delimiter for a dynamic page object, default: Z_
        CodeEnd         = the 2-character ending delimiter, default: _Z
        HTML        = the current HTML string being parsed
        TemplateDir = default template directory (default: Document Root)
        DirectorObj     = An instantiated director object that will handle the z-decoding process

display

Display the named template. It will read the template from the named file or decode the string that was passed in via the HTML property.

Parameters (required)

 Either...
 HTML     => string       - The string to be parsed
 -or-
 FILENAME => string       - Name of file to be parsed

 Parameters (optional):
 ERRORPAGE=> string       - Name of error file to display when FILENAME=> is bad
                            defaults to 'errorpage.html'

 JUSTBODY => boolean      - Extract and display just the body of the HTML data

 CLEAN   => boolean               - Clean extra tags like...
                              remove excess <body>...</body>
                                                                                remove secondary <link href...>

 PATHOK   => boolean      - If OK allow / to start the file name        

 SHOWENV  => boolean      - Show the environment vars in the badpage call

 DEBUG   => boolean               - Show the filename and settings

Restrictions

 FILENAME must end with .htm or .html, can not have '..' in the name, and can not start with a /

Reserved Words Processing

  LOOP_START_<function>[_<int>]
  Mark the start of a repetitive HTML section to be processed in a loop, also defines the function
  that handles our data management and loop processing.

  <function> is called to process each iteration of the loop.

  <function> receives 2 parameters:
  - the current increment count, starting at 1 

  <function> should return true (non-zero) to processed the HTML loop or false (zero) to end loop iteration

  _<int> is set to the maximum number of results to display in the loop.

  LOOP_END
  Mark the end of the repetitive HTML loop.

  LOOP_ITEMS_<integer>
  Set the maximum number of items to display within the loop, defaults to 10.

  INCLUDE(<layername>)
  Includes the specified template file within the current template.
  Not quotes of any kind are used.
  Reads from current template directory by default.
  
  SELF(<setting>)
  Display the specified setting, particularly useful for dumping out the current
  template directory.

AUTHOR

Cyber Sprocket Labs (CSL) is and advanced internet technology consulting firm based in Charleston South Carolina. We provide custom software, database, and consulting services for small to mid-sized businesses.

For more information visit our website at www.cybersprocket.com

COPYRIGHT

(c) 2008, Cyber Sprocket Labs

This script is covered by the GNU GENERAL PUBLIC LICENSE.

http://www.cybersprocket.com/wiki/index.php/GNU_General_Public_License

REVISION HISTORY

  v1.0 - Apr 18 2008
     Based on the original Z-Dedoce HTML Parser Module v2.5
     Renamed from HTMLParser to HTML::TemplateZ for CPAN standard conventions
         Made ZD non-exportable
         Turned all methods into true methods, not functions masquerading as methods
         ZD method has been given the more English-like "display" name
         Removed $OUTPUT parameter passing - always to STDOUT
         Removed ZDprint
         
 v0.4 - Apr 2005
                pod updates
                
 v0.1 - Jan 2004
      Initial private release


CPAN

Personal tools
Cyber Sprocket Labs
Cyber Sprocket Tech