I've seen this problem before. Basically the 'tag' that you have 
returned is being treated as pure data and not a tag at all. A solution? 
Reparse!

Here's what I did:

[GENERAL]
TITLE=HOHOHO
LOGO1=plish

Nevermind the key value pairs, think of the keys as matching TMPL_VARs 
for the purposes of this example. I took the output from one output() 
and basically fed it into a new template with the new_scalar_ref() 
method of the HTML::Template object, like so:

sub _html_from_univ {
    my ($univ, $target ) = @_;
    my $bodyText = _get_universe_data($target);
    my $aRef = HTML::Template->new_scalar_ref(\$bodyText, 
die_on_bad_params=>$bix{'html_die_on_bad_params'});
    return $aRef;
 }

In this implementation the first 'template' is actually a HASH of HASHES 
structure:

{
  'TITLE'=>'<TMPL_VAR NAME="TITLE">',
  'LOGO1'=>'<TMPL_VAR NAME="TITLE"><TMPL_VAR NAME="LOGO1">'
}

Fed to a second template:

<html>
<head>
<title><TMPL_VAR NAME="title"></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
...

Yields:

HOHOHOplish

Mind you that with lots of data this reparsing business is SLOW AS HELL. 
I only included it to show you what is happening. A much better way is 
to alter the data itself prior to pushing it onto the template. Writing 
to the template should, ideally, be the last thing you do for 
efficiency's sake.

Sincerely,

Joel 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to