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:
Non-Cart Files in Shopping Cart Folder (1997)
Credit Card Checksum (1997)
[CART] inside a [LOOP] (1997)
Sendmail - Attachment / My First Post (2001)
all records returned. (1997)
Verifying both name and password (was: New Problem) (1997)
WebDNA tags in WebMerchant email templates ... (1997)
CERT Advisory on malicious scripts (2000)
Items XX to XX shown (1997)
Running _every_ page through WebCat ? (1997)
[include] (1998)
absolute paths for databases? (1997)
WebCat2b15MacPlugin - showing [math] (1997)
WebCat2 - [format thousands] (1997)
F3 crashing server (1997)
GuestBook example (1997)
Multiple cart additions (1997)
Multiple Replaces? (1997)
Multiple prices (1997)
Header info in content (1998)