HTML-DWT

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME
    HTML::DWT - DreamWeaver HTML Template Module

INSTALLATION
  Unzip/tar the archive:

      tar xvfz HTML-DWT-2.08

  Create the makefile

      perl Makefile.PL

  Make the module (must have root access to install)

      make
      make test
      make install

SYNOPSIS
      use HTML::DWT;
  
      $template = new HTML::DWT(filename => "file.dwt");    
      %dataHash = (
                    doctitle => 'DWT Generated',
                    leftcont => 'some HTML content here'    
                    );  
      $html = $template->fill(\%dataHash);
  
      or
  
      use HTML::DWT qw(:Template);
  
      $template = new HTML::DWT(filename => "file.dwt");
      $template->param(
                       doctitle => '<title>DWT Generated</title>',
                       leftcont => 'Some HTML content here'
                       );
      $html = $template->output();

DESCRIPTION
    A perl module designed to parse a simple HTML template file generated by
    Macromedia Dreamweaver and replace fields in the template with values
    from a CGI script.

METHODS
  Options

      use HTML::DWT qw(:Template);

    Using the Template option allows for built in support in HTML::DWT for
    the HTML::Template invocation syntax (param(), output() etc.) See
    HTML::Template for more details. It is best to require a version of 2.05
    for HTML::DWT to support this option.

  new()

      new HTML::DWT("file.dwt");

      new HTML::DWT(
                    filename => "file.dwt",
                    associate => $q,
                    case_sensitive => 1,
                    no_includes => 1,
                    path => '/var/www/html',
                    xml => $xml-data,
                    );

    Creates and returns a new HTML::DWT object based on the Dreamweaver
    template 'file.dwt' (can specify a relative or absolute path). The
    Second instance is recommended, although the first style is still
    supported for backwards compatability with versions before 2.05.

    associate: The associate option allows the template to inherit parameter
    values from other objects. The object associated with the template must
    have a param() method which works like HTML::DWT's param(). Both CGI and
    HTML::Template fit this profile. To associate another object, create it
    and pass the reference scalar to HTML::DWT's new() method under the
    associate option (see above).

    case_sensitive: The case_sensitive option allows HTML::DWT to treat
    template fields in a case-sensitive manner. HTML::DWT's default behavior
    is to match all fields in a case-insensitive manner (i.e. doctitle is
    considered the same as DOCTITLE or DocTitle). Set case_sensitive to 1 to
    over- ride this default behavior.

    no_includes: HTML::DWT will by default look for any included Dreamweaver
    library item files (.lbi files) that may be specified in the template
    using the <!-- #BeginLibraryItem "file.lbi" -> field. The module will
    open the specified library file and will include the file's contents in
    the generated HTML. Setting no_includes to 1 will over-ride this default
    behavior.

    path: HTML::DWT will accept an array of paths under which it will look
    for template and library files. The module will also look in directories
    specified by the environment variables $HTML_TEMPLATE_ROOT and
    $DOCUMENT_ROOT. Absolute path names are not checked, although the
    pseudo-paths '/Library/' and '/Templates/' are treated as relative
    paths.

    xml: HTML::DWT will accept a string value containing an XML document
    that conforms to the HTML-DWT DTD. This string may be associated with
    the template object through the XML option in the constructor. Each
    <item> tag in the XML document will have its contents loaded into a
    corresponding template field. A valid HTML-DWT XML document will look
    like this:

      <?xml version="1.0"?>
      <templateItems template="/Templates/temp.dwt">
        <item name="centercont"><![CDATA[Testing]]></item>
        <item name="doctitle"><![CDATA[<title>testing</title>]]></item>
        <item name="leftcont"><![CDATA[Testing]]></item>
        <item name="rightcont"><![CDATA[Testing]]></item>
      </templateItems>

    These documents can be automaticly generated both by HTML::DWT based on
    template data using export(), or by Macromedia Dreamweaver.

  fill()

      $template->fill(\%dataHash);

      $template->fillTemplate(\%dataHash);

    Takes a hash reference where the keys are the named areas of the
    template and the associated values are HTML content for those areas.
    This method returns a complete HTML document, which can then be sent to
    STDOUT (the browser). The fill() method is the prefered means of
    accessing this functionality; fillTemplate() is implemented only to
    support versions of HTML::DWT earlier than version 2.05.

  param()

      $template->param();

      $template->param('doctitle');

      $template->param(
                      doctitle => '<title>DWT Generated</title>',
                      leftcont => 'Some HTML content here'
                      );

    Takes a hash of one or more key/value pairs, where each key is a named
    area of the template, and the associated value is the HTML content for
    that area. This method returns void (HTML substitiutions are stored
    within the object awaiting output()).

    If called with a single paramter--this parameter must be a valid field
    name--param() returns the value currently set for the field, or undef if
    no value has been set.

    If called with no parameters, param() returns a list of all field names.

    NOTE: All Dreamweaver templates store the HTML page's title in a field
    named 'doctitle'. HTML::DWT will accept a raw title (without <title>
    tags) and will add the appropriate tags if the content of the 'doctitle'
    field should require them.

    This is a HTML::Template compatible method.

  clear_params()

      $template->clear_params();

    Clears all field values from the template's parameter list and sets each
    parameter to an undefined value.

    This is a HTML::Template compatible method.

  output()

      $template->output();
  
      $template->output(print_to => \*STDOUT);

    Returns the parsed template and its substituted HTML for output. The
    template must be filled using either fill() or param() before calling



( run in 0.575 second using v1.01-cache-2.11-cpan-e1769b4cff6 )