Re: IT flow parser (was: an HTML_Template_IT[X] fork is available)

From: Date: Tue, 11 Feb 2003 20:15:13 +0000
Subject: Re: IT flow parser (was: an HTML_Template_IT[X] fork is available)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13137@lists.php.net to get a copy of this message
Bertrand Mansion wrote:
Hello everyone! I have one question about using HTML_Template_IT.php can IT hanle this situation? : I want to made highlighting of selected menu item.. $menu = $page->getAdminMenu($a); // $a = auth. $t->setCurrentBlock('menu_item'); foreach ($menu as $item) { if ($page->isSelected($item)) { $t->setCurrentBlock('menu_item_selected'); } $t->setVariable(array(
      "MENU_URL" => $item[url],
      "MENU_NAME" => $item[name],
)); $t->parseCurrentBlock(); } template: <!-- BEGIN menu --> <!-- BEGIN menu_item -->
       <a href="{MENU_URL}">{MENU_NAME}</a><br>
<!-- END menu_item --> <!-- BEGIN menu_item_selected -->
       <b><u><a href="{MENU_URL}">{MENU_NAME}</a></b></u><br>
<!-- END menu_item_selected --> <!-- END menu -->
Unfortunately, I don't think that's possible. It would make a really useful addition to the current code. I also need this to integrate IT with QuickForm. Some sort of flow parser. I wish a (lead) developer could come up with a solution ;)
Heh. In fact, it is quite possible (tested with my version, should work with stock one as well): foreach ($menu as $item) {
    if ($page->isSelected($item)) {
        $t->setCurrentBlock('menu_item_selected');
    } else {
        $t->setCurrentBlock('menu_item');
    }
    $t->setVariable(array(
         "MENU_URL" => $item[url],
         "MENU_NAME" => $item[name],
    ));
    $t->parseCurrentBlock();
    $t->parse('menu');
}

« previous php.pear.dev (#13137) next »