What is WebDNA

WebDNA is a scripting and database system designed to easily build web applications.

WebDNA and BioType

BioType service is a biometric keystroke dynamic system. It will be part of WebDNA 8.5

Download WebDNA

Download WebDNA freeware, try it and register later if you want.

WebDNA resources

The list of all WebDNA instructions.
WebDNA
Software Corporation
Search WebDNA Site
 Menu


HOME


DOWNLOADS


LEARN


EDUCATION


NEWS


COMMUNITY


STORE


SUPPORT


CONTACT

Re: [WebDNA] SWITCH/CASE or SHOWIF

This WebDNA talk-list message is from

2008


It keeps the original formatting.
numero = 101489
interpreted = N
texte = On Thu, 20 Nov 2008 14:53:13 -0500 Ki Song wrote: > We have about a 100 different brands at our store. > Some brands have "static" brand pages (brand/index.html) while others h= ave "dynamic" brand pages=20 >(dynamic.tpl?brand=3Dsomebrand). >=20 > 1. To go through 100 different choices, is a switch/case more efficient= or 100 showif statements=20 >more efficient? My instict is that switch/case would be faster since it seems to be a "si= ngle" operation vs 100=20 [showif] operations, but it is untested and based on nothing but my own b= uest guess. Try a test similar to these and wrap [elapsedtime] around them or compare= the start [time] to the=20 end [time]: [text]x=3D[math]ceil([RANDOM format=3Dfloat]*(100))[/math][/text] [Switch value=3D[x]] [loop start=3D1&end=3D100] [Case value=3D[index]]The value of x is [x][/Case] [/loop] [Default] [!]--The "default" case is probably not needed here since one of t= hese cases will *always*=20 be true, but hey, I still end my [search]es w/ [/search] --[/!] [/Default] [/Switch] ------------ [text]x=3D[math]ceil([RANDOM format=3Dfloat]*(100))[/math][/text] [loop start=3D1&end=3D100] [showif [x]=3D[index]]The value of x is [x][/showif] [/loop] I'd be curious to see what the results are. > 2. In the final generated HTML code, when 100 SHOWIF statements are pro= cessed, but only 1 is=20 >actually shown, the other 99 SHOWIF statements create line breaks. Is th= ere a way to prevent the=20 >line breaks from showing up if a showif does not evaluate to true? I got this one from someone on the list: Wrap all "line-breaky" code like this: [getchars start=3D1&end=3D&trim=3Dboth] [grep search=3D[%0D%0A][%0D%0A%09]*&replace=3D%0D] ... your line-breaky code goes here ... [/grep] [/getchars] >=20 > 3. Does a SWITCH/CASE statement create line breaks for all the cases th= at evaluate to false? Dunno, but if so, wrap like above. -Dan Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
  2. Re: [WebDNA] SWITCH/CASE or SHOWIF ("Dan Strong" 2008)
  3. Re: [WebDNA] SWITCH/CASE or SHOWIF (Toby Cox 2008)
  4. Re: [WebDNA] SWITCH/CASE or SHOWIF (Govinda 2008)
  5. Re: [WebDNA] SWITCH/CASE or SHOWIF ("Dan Strong" 2008)
  6. Re: [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
  7. Re: [WebDNA] SWITCH/CASE or SHOWIF (Govinda 2008)
  8. [WebDNA] SWITCH/CASE or SHOWIF (Ki Song 2008)
On Thu, 20 Nov 2008 14:53:13 -0500 Ki Song wrote: > We have about a 100 different brands at our store. > Some brands have "static" brand pages (brand/index.html) while others h= ave "dynamic" brand pages=20 >(dynamic.tpl?brand=3Dsomebrand). >=20 > 1. To go through 100 different choices, is a switch/case more efficient= or 100 showif statements=20 >more efficient? My instict is that switch/case would be faster since it seems to be a "si= ngle" operation vs 100=20 [showif] operations, but it is untested and based on nothing but my own b= uest guess. Try a test similar to these and wrap [elapsedtime] around them or compare= the start [time] to the=20 end [time]: [text]x=3D[math]ceil([RANDOM format=3Dfloat]*(100))[/math][/text] [Switch value=3D[x]] [loop start=3D1&end=3D100] [Case value=3D[index]]The value of x is [x][/Case] [/loop] [Default] [!]--The "default" case is probably not needed here since one of t= hese cases will *always*=20 be true, but hey, I still end my [search]es w/ [/search] --[/!] [/Default] [/Switch] ------------ [text]x=3D[math]ceil([RANDOM format=3Dfloat]*(100))[/math][/text] [loop start=3D1&end=3D100] [showif [x]=3D[index]]The value of x is [x][/showif] [/loop] I'd be curious to see what the results are. > 2. In the final generated HTML code, when 100 SHOWIF statements are pro= cessed, but only 1 is=20 >actually shown, the other 99 SHOWIF statements create line breaks. Is th= ere a way to prevent the=20 >line breaks from showing up if a showif does not evaluate to true? I got this one from someone on the list: Wrap all "line-breaky" code like this: [getchars start=3D1&end=3D&trim=3Dboth] [grep search=3D[%0D%0A][%0D%0A%09]*&replace=3D%0D] ... your line-breaky code goes here ... [/grep] [/getchars] >=20 > 3. Does a SWITCH/CASE statement create line breaks for all the cases th= at evaluate to false? Dunno, but if so, wrap like above. -Dan "Dan Strong"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[OT] Airport Network (2003) WebCat2 - [include] tags (1997) Cold Fusion Buster (1997) OFF-TOPIC: Check www.godaddy.com for me ... (2003) OK, here goes... (1997) WebCat2 - [format thousands] (1997) encrypt but with normal characters for result? (2005) Superfilous Characters (1998) Word wrapping (1997) Search design (1997) Introduction/Tutorial/QuickStart (1997) [showif] not working (2003) multi-paragraph fields (1997) Error 11 (1996) Grouping Fields (2006) Multiple Newcarts (1996) WebCat b13 CGI -shownext- (1997) Hosting Service (1998) %@#*& back button!!! (1999) Bug Report, maybe (1997)