RE: [Phplib-users] Template problems
Brought to you by:
nhruby,
richardarcher
From: Rob H. <rob...@ws...> - 2002-09-25 13:41:45
|
OK, Finally found the answer to my own problems. 1) I was missing spaces either after the <!-- or before the -->. I know that their have to be some regex rules, but could they be relaxed to accept <!--BEGIN blockname-->? 2) I did the set block in the reverse order, starting with the outermost and working inwards. I thought this was correct because the template system needed to understand the layering. I would suggest a link in the documentation area of the sourceforge site to http://www.devshed.com/Server_Side/PHP/PHPLib/page1.html or simply grab the printer friendly or pdf version and post it to the documentation section. I would be happy to add links to the documentation area and get permission from the people who have published them as I run across them if someone wants to grant me admin priviledges... 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 > -----Original Message----- > From: php...@li... > [mailto:php...@li...]On Behalf Of Rob Hutton > Sent: Wednesday, September 25, 2002 7:32 AM > To: php...@li... > Subject: RE: [Phplib-users] Template problems > > > To provide a little more information, I have looked at code written by > others and I have not found anyone using layered blocks. All the > code that > I have found achieves a similar effect by defining blocks linearly and > putting a placeholder where the sub block would go and parsing into this > variable. Is this a better way of going at things? > > 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 > > > > -----Original Message----- > > From: php...@li... > > [mailto:php...@li...]On Behalf Of Rob Hutton > > Sent: Tuesday, September 24, 2002 7:25 PM > > To: php...@li... > > Subject: [Phplib-users] Template problems > > > > > > 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 > > > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > Phplib-users mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phplib-users > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > |