[phplib] set_block problems From: Tanya Brethour (brethour <email protected>)
Date: 06/05/01

Ok, I have been searching the archives for some help with my error, but
the solutions I have found.. do not seem to work quite right...

So.. please excuse me if I am repeated a common question.

I am getting errors such as this:
Template Error: loadfile: title is not a valid handle.
Halted.

I do have a title block in my template file.

Things to note.. the set_block call is within a function. The first time I
call this function.. it works fine with no error. The second time the
function is called.. I get the "not a valid handle" error. Why does this
error occur when I call the function multiple times?

example function:
function title_bar ($header="", $center=0) {
  global $title_tpl;

  if (empty ($title_tpl)) {
    $title_tpl = new Template ("/usr/local/MHonArc/PHP/", "keep");
    $title_tpl->set_file ("page", "title_bar.tpl");
  }

  if (!$header) {
    return blank_bar ();
  }

  $title_tpl->set_var (array (
    "HEADING" => $header));
    
  if ($center) {
    $title_tpl->set_var (array ('ALIGN' => "center"));
  }
  else {
    $title_tpl->set_var (array ('ALIGN' => "left"));

  $title_tpl->set_block('page', 'title');
  $title_tpl->pparse('out', 'title');
}

Any suggestions? Please let me know if I can provide more information.

Thanks,
Tanya Brethour

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>