RE: [Phplib-users] Multiple blocks per line
Brought to you by:
nhruby,
richardarcher
From: Brian P. <bp...@ct...> - 2002-09-24 18:59:51
|
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 > |