RE: [Phplib-users] Multiple blocks per line
Brought to you by:
nhruby,
richardarcher
From: Brian P. <bp...@ct...> - 2002-09-24 19:34:18
|
Ok.. as long as you have a practical objection to the method and not a technical one. I personally disagree. If you are trying to separate logic and your GUI (the whole point of templates), I would recommend doing as much branching and conditional logic in the code as possible. What's an HTML designer that doesn't know anything about code going to do when they come across 25 blocks (or comments as far as they are concerned) of links. Not to mention, if you work in a GUI editor, the output is going to be very WYSIN(ot)WYG. I understand this is holy war and there is no "right" answer, but some answers ARE better than others (ehemm!). :) -bpopp -----Original Message----- From: Rob Hutton [mailto:rob...@ws...] Sent: Tuesday, September 24, 2002 2:17 PM To: Brian Popp; php...@li... Subject: RE: [Phplib-users] Multiple blocks per line Debugging code is harder with the more indirections. It is more straight forward to handle the indirection in the code generating the output, not generate the code that does indirection, then decide. You have two places things could go wrong then. 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 Brian Popp > Sent: Tuesday, September 24, 2002 3:17 PM > To: 'rob...@ws...'; 'php...@li...' > Subject: RE: [Phplib-users] Multiple blocks per line > > > I'm not following you? Sounds like you found the answer you were looking > for, but I'm just curious why this wouldn't be more readable than > 25 blocks > of HREF statements: > > <a onClick="{url}"> > > and then: > > <? > > switch ( $type ) > { > case ITEM_TYPE1: > $function = "item_function1( $parameters );"; > break; > > case ITEM_TYPE2: > $function = "item_function2( $parameters );"; > break; > > case ITEM_TYPE3: > $function = "item_function3( $parameters );"; > break; > > ... > } > > $t->set_var ( "url", "javascript:$function; return;" ); > > ?> > > Am I missing something? > > -----Original Message----- > From: Rob Hutton [mailto:rob...@ws...] > Sent: Tuesday, September 24, 2002 1:45 PM > To: Brian Popp; php...@li... > Subject: RE: [Phplib-users] Multiple blocks per line > > > The point is that there are about 25 different functions that could be > called in an onclick that will be called based on what sort of item it is. > I could wrap them in a function, and pass the type as a > parameter, but I was > trying to keep the HTML as readable as possible. > > 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: Brian Popp [mailto:bp...@ct...] > > Sent: Tuesday, September 24, 2002 2:45 PM > > To: 'rob...@ws...'; 'php...@li...' > > Subject: RE: [Phplib-users] Multiple blocks per line > > > > > > That's a hard way to do what it looks like you're trying to do. > > Instead, I'd > > do something like: > > > > <a onClick="{url}"> > > > > in the template, and then in your code: > > > > if ( $x == 1 ) > > $t->set_var ( "url", "javascript:function($parameter1); return > > true;" ); > > else > > $t->set_var ( "url", "javascript:function($parameter2); return > > true;" ); > > > > (or something to this effect) > > > > -bpopp > > > > -----Original Message----- > > From: Rob Hutton [mailto:rob...@ws...] > > Sent: Tuesday, September 24, 2002 1:21 PM > > To: php...@li... > > Subject: [Phplib-users] Multiple blocks per line > > > > > > I have a need to do something like > > > > <a onClick="<!-- BEGIN block1 -->function({param});<!-- END > block1 --><!-- > > BEGIN block2 -->function({param});<!-- END block2 -->return true;"> > > > > When I try this, I get "block1" or "block2" is not a valid handle > > when I try > > to set block. Is there a way to do this? > > > > Rob Hutton > > Web Safe > > www.wsafe.com > > > > > > > > > > > > ------------------------------------------------------- > > 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 > |