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:
Webten + Webcat running smooth (1998)
WebCatalog [FoundItems] Problem - LONG - (1997)
Using Plug-In while running 1.6.1 (1997)
WebCat2.0 acgi vs plugin (1997)
RE: Symantec VIsual Page 1.0.3 (1997)
WebCat2 several catalogs? (1997)
NEW 4.X BUG?!?!?!? - WAS: The force has left me. (2002)
Error -108 (1997)
WebCat2b13MacPlugIn - [shownext method=post] ??? (1997)
Using Plug-In while running 1.6.1 (1997)
Quitting WebMerchant ? (1997)
I think WebDNA-Talk died ... :( (1997)
shoppingcart reload qty (1997)
Cookie Problems (2000)
WebCat2b12plugin - [search] is broken ... not! (1997)
F3 crashing server (1997)
# fields limited? (1997)
2nd WebCatalog2 Feature Request (1996)
websitepro/webcat/registry? (1998)
pop up menu's (1998)