Re: Coding Technique
This WebDNA talk-list message is from 2000
It keeps the original formatting.
numero = 32627
interpreted = N
texte = You may have missed a discussion that has been going on as recently asyesterday on this list. Look for the subject line:Too many webcat comments. [WAS- Large founditems loops]There have been reports of this method causing problems.Mike> This is such a great idea, I have to tell you all. (Maybe it's all old hat.)> > Often times you need to use several lines of code to set a value. Like> this:> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems]> [text]thePrice=[price][/text]> [showif [qty]>[level2]][text]thePrice=[price2][/text][/showif]> [showif [qty]>[level3]][text]thePrice=[price3][/text][/showif]> [/founditems][/search][thePrice]> > The problem if this is in an include file and you do something like> > [text]finalPrice=[include priceCalc.tmpl][/text]> > All those Return characters get added to your value, messing up the> calculations. So what do you do? You take out the Returns, and you get> code that looks like this:> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][text]> thePrice=[price][/text][showif [qty]>[level2]][text]thePrice=[pri> ce2][/text][/showif][showif [qty]>[level3]][text]thePrice=[price3> ][/text][/showif][/founditems][/search][thePrice]> > (All on one line...)> > You can't read it very easily or debug it without adding the returns back> in. The solution is to use WebDNA comments! Then you get to keep the> readable code. You can also put in comments if you want!> > > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][!]> [/!][text]thePrice=[price][/text][!] This is the standard price> [/!][showif [qty]>[level2]][text]thePrice=[price2][/text][/showif][!]> [/!][showif [qty]>[level3]][text]thePrice=[price3][/text][/showif][!]> [/!][/founditems][/search][thePrice]> > or even line numbers....> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][!]> 1: [/!][text]thePrice=[price][/text][!]> 2: [/!][showif [qty]>[level2]][text]thePrice=[price2][/text][/showif][!]> 3: [/!][showif [qty]>[level3]][text]thePrice=[price3][/text][/showif][!]> [/!][/founditems][/search][thePrice]> > One of my employees came up with this while coding an export into a fixed> width format file. Now I use it all the time. Just make sure you match the> [!] with the [/!]> > > Phil Marshall-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list
.To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Associated Messages, from the most recent to the oldest:
You may have missed a discussion that has been going on as recently asyesterday on this list. Look for the subject line:Too many webcat comments. [WAS- Large founditems loops]There have been reports of this method causing problems.Mike> This is such a great idea, I have to tell you all. (Maybe it's all old hat.)> > Often times you need to use several lines of code to set a value. Like> this:> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems]> [text]thePrice=[price][/text]> [showif [qty]>[level2]][text]thePrice=[price2][/text][/showif]> [showif [qty]>[level3]][text]thePrice=[price3][/text][/showif]> [/founditems][/search][thePrice]> > The problem if this is in an include file and you do something like> > [text]finalPrice=[include priceCalc.tmpl][/text]> > All those Return characters get added to your value, messing up the> calculations. So what do you do? You take out the Returns, and you get> code that looks like this:> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][text]> thePrice=[price][/text][showif [qty]>[level2]][text]thePrice=[pri> ce2][/text][/showif][showif [qty]>[level3]][text]thePrice=[price3> ][/text][/showif][/founditems][/search][thePrice]> > (All on one line...)> > You can't read it very easily or debug it without adding the returns back> in. The solution is to use WebDNA comments! Then you get to keep the> readable code. You can also put in comments if you want!> > > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][!]> [/!][text]thePrice=[price][/text][!] This is the standard price> [/!][showif [qty]>[level2]][text]thePrice=[price2][/text][/showif][!]> [/!][showif [qty]>[level3]][text]thePrice=[price3][/text][/showif][!]> [/!][/founditems][/search][thePrice]> > or even line numbers....> > [search db=admin/product.db&eqSKUdata=[theSKU]][founditems][!]> 1: [/!][text]thePrice=[price][/text][!]> 2: [/!][showif [qty]>[level2]][text]thePrice=[price2][/text][/showif][!]> 3: [/!][showif [qty]>[level3]][text]thePrice=[price3][/text][/showif][!]> [/!][/founditems][/search][thePrice]> > One of my employees came up with this while coding an export into a fixed> width format file. Now I use it all the time. Just make sure you match the> [!] with the [/!]> > > Phil Marshall-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/
Mike Davis
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:
[WebDNA] can webdna set the email header (w/[sendmail]) that controls where bounced email goes? (2012)
2.0Beta Command Ref (can't find this instruction) (1997)
how do I delete 1 of 2 identical records? (2003)
weird convertchars behavior (2000)
Server problem? (1998)
RE: Sorting error (1997)
Moment of Thanks (1997)
[WebDNA] OT: How is this being done? Curious. (2009)
[listfiles] problems (1997)
[WebDNA] Friday's.. WIP thread (2009)
Printing controls - form feeds (2002)
links to .db's ? (1999)
Multiple download orders of the same product? (1997)
Listserver problem (1997)
Uploading out of FMP (2001)
Help formatting search results w/ table (1997)
Buying sans cart (1997)
Explorer oddities (1997)
Hosting Service (1998)
OFF-TOPIC...list serve software for newsletter? (1998)