about func. replaceBlock()

Do you have questions regarding Pecl or Pear? ask here!

Moderators: macek, egami, gesf

peppevh
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Feb 13, 2012 9:23 am

about func. replaceBlock()

Postby peppevh » Mon Feb 13, 2012 10:34 am

First, sorry for my english (so bad!!)
I have a problem with a example using replaceBlock() function.
This following code dont run and i dont know why, i try in a lot of way ... but nothing
Someone can help me building a correct example using the replaceBlock function?

Code: Select all

<?php
   
   require_once "HTML/Template/ITX.php";
   
   $msg = "numero 1";
   $a = 3;
   
   $template = new  HTML_Template_ITX("templates");
   
   
   $template->loadTemplatefile("about_today1.tpl", true, true);
   
   print $a;
   print "<br>";
   
   if ($a > 2)
      $template->replaceBlock("PROVA", "about_today3.tpl", true);   
   
   $template->setCurrentBlock("PROVA");
   $template->setVariable("MESSAGE", $msg);
   $template->parseCurrentBlock();
   $template->show();
   
?>


about_today1.tpl :

Code: Select all

<html>

   <hrad>
      <title>About today</title>
   </head>
   
   <body>
      <!-- BEGIN PROVA -->
      {MESSAGE}
      <!-- END PROVA -->
   
   </body>


</html>



about_today3.tpl :

Code: Select all

Sono3: {MESSAGE}


... the condition if ($a > 2) is true, but the block in not replaced correctly and the page is blank
maybe i use not corrctle the function, but i try again in a lot way.
Thank you.

Return to “PEAR and PECL”

Who is online

Users browsing this forum: No registered users and 1 guest

cron