numero = 34862
interpreted = N
texte = Steven-[formvariables] will display all of the form variables that are passed to apage (of course in my example, the page passes them to itself).Formvariables will loop through all of these variables, which gives me ahandy way of doing my [replaces] in the database.Tacking another variable onto the end of a variable (as i've done) gives mea convenient, shorthand way of giving the variable on each founditems line aunique name, and I can recover what its value was set to with theformvariables context.Here's a simple example. Suppose I have an online store shirthaus.comCustomers can order shirts and specify the size. So, my orders.db lookssomething like:Name OrderNumber Size SKUJohn Q 20 S 001John Q 20 M 003Joe B 21 M 002Jane D 22 XL 005Notice that John Q has ordered 2 shirts, one small and one medium. Joe hasordered a medium shirt and Jane has ordered and extralarge shirt.Now, let's say I want to give customers access to this db, to change a sizebefore I ship the order to them.What I'll do is create a template that'll search the database, based on, saythe order number. I'll have a table on the results page that'll display thefounditems. Let's take John has an example. This is what the table on thecustomer login page will look like:You ordered the follwing items. Please make any changes to size by 5 pmtoday:Name Ordernumber Size SKUJohn Q 20 S 001John Q 20 M 003Now, the only field John can change is size. So, the HTML for thatformvariable looks likeWhat this code does is create two formvariables when the html parses, right?One is named size001 and the other is size003 (size+[sku]).OK, so far so good. Now, let's say John is has used my form to change thesize of the first shirt in his order to large. When he hits 'submit', thenew values for these variables are going to be re-presented to the page(because the action of the form points to this page) and now I am going totake these new values and change what's in my database to reflect thechange.Since formvariables will give me a list of all the variables presented tothe page, I can simply do:[formvariables][showif [made_db_changes]=T][replace db=orders.db&eqordernumberdata=[ordernumber]&eqskudata=[sku]]size=[interpret][size[sku]][/interpret][/showif][/formvariables]One helpful way to figure out what contexts are doing is to go ahead andreplace the variables with their values and it becomes pretty clear what isgoing on:What'll happen with the above is:[replace db=orders.db&ordernumber=20&eqskudata=001]size=L [/replace][replace db=orders.db&ordernumber=20&eqskudata=003]size=M [/replace]I hope this clarifies things. The best way to understand these concepts isto make a simple database and template, and mess with it until youunderstand how all of this works...(and, keeping asking questions ;)-- Will StarckNovaDerm Product and Technical Supporthttp://www.novaderm.comtechs@novaderm.com> From: Steven Jarvis > Reply-To: (WebCatalog Talk)> Date: Wed, 19 Jul 2000 11:55:38> To: (WebCatalog Talk)> Subject: Re: temporary database? an aside> > Will,> > >> 4) Place the following code snippet (modify to suit your situation) just>> inside the founditems of the search:>> >> >> [formvariables]>> [showif [made_db_changes]=T]>> [replace >> db=orders.db&eqordernamedata=[ordername]]materials=[interpret][materials[ord>> ername]][/interpret]>> [/showif]>> [/formvariables]>> >> > > I'm new to WC, and I've seen quite a bit of code around here (designed by my> predecessor) and on the list where the formvariables context is wrapped> around a bunch of code.> > The docs don't seem to indicate any such useof that context. Can you (or> someone else) explain why you do that?> > Thanks!> > Steve> > > ------------------------------------------------> Steven Jarvis> Web Developer> sjarvis@nwaonline.net> > Morning News of Northwest Arkansas> http://www.nwaonline.net> ------------------------------------------------> > > > -------------------------------------------------------------> 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/-------------------------------------------------------------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:
Re: temporary database? an aside (Will Starck 2000)
Steven-[formvariables] will display all of the form variables that are passed to apage (of course in my example, the page passes them to itself).Formvariables will loop through all of these variables, which gives me ahandy way of doing my [replaces] in the database.Tacking another variable onto the end of a variable (as i've done) gives mea convenient, shorthand way of giving the variable on each founditems line aunique name, and I can recover what its value was set to with theformvariables context.Here's a simple example. Suppose I have an online store shirthaus.comCustomers can order shirts and specify the size. So, my orders.db lookssomething like:Name OrderNumber Size SKUJohn Q 20 S 001John Q 20 M 003Joe B 21 M 002Jane D 22 XL 005Notice that John Q has ordered 2 shirts, one small and one medium. Joe hasordered a medium shirt and Jane has ordered and extralarge shirt.Now, let's say I want to give customers access to this db, to change a sizebefore I ship the order to them.What I'll do is create a template that'll search the database, based on, saythe order number. I'll have a table on the results page that'll display thefounditems. Let's take John has an example. This is what the table on thecustomer login page will look like:You ordered the follwing items. Please make any changes to size by 5 pmtoday:Name Ordernumber Size SKUJohn Q 20 S 001John Q 20 M 003Now, the only field John can change is size. So, the HTML for thatformvariable looks likeWhat this code does is create two formvariables when the html parses, right?One is named size001 and the other is size003 (size+[sku]).OK, so far so good. Now, let's say John is has used my form to change thesize of the first shirt in his order to large. When he hits 'submit', thenew values for these variables are going to be re-presented to the page(because the action of the form points to this page) and now I am going totake these new values and change what's in my database to reflect thechange.Since formvariables will give me a list of all the variables presented tothe page, I can simply do:[formvariables][showif [made_db_changes]=T][replace db=orders.db&eqordernumberdata=[ordernumber]&eqskudata=[sku]]size=[interpret][size[sku]][/interpret][/showif][/formvariables]One helpful way to figure out what contexts are doing is to go ahead andreplace the variables with their values and it becomes pretty clear what isgoing on:What'll happen with the above is:[replace db=orders.db&ordernumber=20&eqskudata=001]size=L [/replace][replace db=orders.db&ordernumber=20&eqskudata=003]size=M [/replace]I hope this clarifies things. The best way to understand these concepts isto make a simple database and template, and mess with it until youunderstand how all of this works...(and, keeping asking questions ;)-- Will StarckNovaDerm Product and Technical Supporthttp://www.novaderm.comtechs@novaderm.com> From: Steven Jarvis > Reply-To: (WebCatalog Talk)> Date: Wed, 19 Jul 2000 11:55:38> To: (WebCatalog Talk)> Subject: Re: temporary database? an aside> > Will,> > >> 4) Place the following code snippet (modify to suit your situation) just>> inside the founditems of the search:>> >> >> [formvariables]>> [showif [made_db_changes]=T]>> [replace >> db=orders.db&eqordernamedata=[ordername]]materials=[interpret][materials[ord>> ername]][/interpret]>> [/showif]>> [/formvariables]>> >> > > I'm new to WC, and I've seen quite a bit of code around here (designed by my> predecessor) and on the list where the formvariables context is wrapped> around a bunch of code.> > The docs don't seem to indicate any such useof that context. Can you (or> someone else) explain why you do that?> > Thanks!> > Steve> > > ------------------------------------------------> Steven Jarvis> Web Developer> sjarvis@nwaonline.net> > Morning News of Northwest Arkansas> http://www.nwaonline.net> ------------------------------------------------> > > > -------------------------------------------------------------> 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/-------------------------------------------------------------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/
Will Starck
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...