[Phplib-users] Template problems
Brought to you by:
nhruby,
richardarcher
From: Rob H. <rob...@ws...> - 2002-09-24 23:20:28
|
OK, couple of more questions. I'm just not getting how things are laid out and interrelated. I have a base template for a page with a place holder in it for a menu {mainMenu}. I have another template called side menu with the following structure. *menu.tpl some javascript code <!-- BEGIN block1 --> function({block1var}); <!-- END block1 --> <!-- menuItemBlock --> <!-- BEGIN childblock1 --> {var1} {var2} <!-- END childblock1 --> <!-- BEGIN childblock2 --> {var 3} <!-- END childblock2 --> {var 4} <!-- menuItemBlock --> The code in the side menu page gets included in them main page fine. The problem that I am having is in processing the menu page. Both 'block1' and 'menu' item block can appear multiple times in one menu. So I do a: $t->set_file('menu','leftmenu.tpl'); $t->set_block('menu','block1','block1place'); reset ($mainMenu); while (list ($key, $val) = each ($mainMenu)) { $t->set_var(array('block1var' => $key)); $t->parse('block1place', 'block1', true); } It gets added once for each pass through $mainMenu as it should. But when I do a similar thing with menuItemBlock, I only get it added once the last time through. Here is what I am doing. reset ($mainMenu); while (list ($key, $val) = each ($mainMenu)) { $t->set_block('mainMenuItem','childblock1','childblock1holder'); $t->set_var(array( 'var1' => $val1, 'var2' => $val2)); $t->parse('childblock1', 'childblock1', true); $t->set_block('mainMenuItem','childblock2','childblock2holder'); $t->set_var(array('var3' => $val2)); $t->parse('childblock1', 'childblock1', true); $t->set_block('menu','menuItemBlock','menuItem'); $t->set_var(array('var4 => $val4); $t->parse('menutItem','menuItemBlock', true); } I only get one menuItemBlock for the last time through. All this to say, is there a document somewhere that better covers Templates and child blocks? If not, I've read through the source once and am confused. I guess I don't understand the overall structure. Thanks, Rob Hutton Web Safe www.wsafe.com ********************************************************************** Introducing Symantec Client Security - Integrated Anti-Virus, Firewall, and Intrusion Detection for the Client. Learn more: http://enterprisesecurity.symantec.com/symes238.cfm?JID=2&PID=11624271 View our Symantec Client Security Demo: http://enterprisesecurity.symantec.com/symes238.cfm?JID=3&PID=11624271 Download the Symantec Client Security Fact Sheet: http://enterprisesecurity.symantec.com/symes238.cfm?JID=4&PID=11624271 Download the Symantec Client Security Brochure: http://enterprisesecurity.symantec.com/symes238.cfm?JID=5&PID=11624271 |