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:
AOL and webcat (1998)
[urgent] Phone number at SM (2006)
[WebDNA] Competitors! (2008)
WebCat2b13MacPlugIn - More limits on [include] (1997)
Problems getting parameters passed into email. (1997)
Quitting WebMerchant ? (1997)
OT: Amazon Patents (2000)
Help name our technology! I found it (1997)
CMSBuilder (2004)
PROBLEM (1997)
Generating unique SKU from [cart] (1997)
[FoundItems] solved - thanks (1997)
2.0 Info (1997)
Bug or syntax error on my part? (1997)
_ in front of field name (1998)
Textarea (1998)
Reversed words (1997)
[WebDNA] EMailFolder/ (2016)
[append] and SSL (1997)
HELP! Only 1/2 of pricing.db loading!?! (1999)