[WebDNA] passing a variable in an include - precedence

This WebDNA talk-list message is from

2015


It keeps the original formatting.
numero = 112520
interpreted = N
texte = 88 Working on 8.2, we have decided to work on an issue mentioned by = Donovan: > Here is the test page: > http://www.euca.us/admin/tests/include-bug/test.html >=20 > The main issue for discussion is that when passing a variable in an = include >=20 > [include file=3Dsomefile.inc&var=3Dsomevalue] >=20 > You can=E2=80=99t overwrite the var value with a text context = [text]=E2=80=A6[/text] within somefile.inc. >=20 > So, if I do >=20 > [include file=3Dsomefile.inc&var=3D1] >=20 > it is fine. the tag [var] in the included file shows "1" >=20 > but if I do > [text]var=3D2[/text] > [include file=3Dsomefile.inc&var=3D[var]] >=20 > then the tag [var] in the included file shows "[var]" instead of "2" This isn't a simple problem, it goes pretty deep into how WebDNA = retrieves variables. The order of precedence for variable lookups is: 1.) [INCLUDE] cgi parameters 2.) text variables 3.) math variables 4.) regular cgi parameters (passed via URL or POST) These variables are all kept in separate variable lists, and there is = normally no checking between lists. So you can have a text and a CGI = variable with the same name at the same time. Normally, WebDNA is taking advantage of the fact that regular CGI = parameters are going to be the earliest assignment of any variable, so = they can be treated with lowest priority and it will work correctly. = However, when you do an include, we need to create a new set of CGI = parameters that are treated as highest priority inside of a new context. = This creates all sorts of problems with getting the order of precedence = correct. We decided the best solution is to make all assignments of text = variables delete similarly named CGI parameters in all [INCLUDE] = contexts. This makes it work correctly even if you include a file inside = of another include. [math] variable assignments though will still be ignored if there is a = conflicting variable passed via an include. [math] variables are already treated as inferior. For example, this code = returns Var=3D4: [text]var=3D4[/text] [math]var=3D1[/math] Var=3D[var] With 8.2, Donovan test shows this output now: Value of VAR from first include: 1 Value of VAR after setting it in first include: 2 Value of VAR from second include: 2 --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] passing a variable in an include - precedence (christophe.billiottet@webdna.us 2017)
  2. Re: [WebDNA] passing a variable in an include - precedence (christophe.billiottet@webdna.us 2017)
  3. Re: [WebDNA] passing a variable in an include - precedence (Tom Duke 2017)
  4. Re: [WebDNA] passing a variable in an include - precedence (Stuart Tremain 2017)
  5. Re: [WebDNA] passing a variable in an include - precedence (Donovan Brooke 2017)
  6. Re: [WebDNA] passing a variable in an include - precedence (Tom Duke 2017)
  7. Re: [WebDNA] passing a variable in an include - precedence (christophe.billiottet@webdna.us 2017)
  8. Re: [WebDNA] passing a variable in an include - precedence (Tom Duke 2017)
  9. Re: [WebDNA] passing a variable in an include - precedence ("Matthew A Perosi, Psi Prime" 2015)
  10. Re: [WebDNA] passing a variable in an include - precedence (Donovan Brooke 2015)
  11. Re: [WebDNA] passing a variable in an include - precedence ("Matthew A Perosi, Psi Prime" 2015)
  12. Re: [WebDNA] passing a variable in an include - precedence (Donovan Brooke 2015)
  13. Re: [WebDNA] passing a variable in an include - precedence (Matthew Perosi 2015)
  14. Re: [WebDNA] passing a variable in an include - precedence (Kenneth Grome 2015)
  15. [WebDNA] passing a variable in an include - precedence (christophe.billiottet@webdna.us 2015)
88 Working on 8.2, we have decided to work on an issue mentioned by = Donovan: > Here is the test page: > http://www.euca.us/admin/tests/include-bug/test.html >=20 > The main issue for discussion is that when passing a variable in an = include >=20 > [include file=3Dsomefile.inc&var=3Dsomevalue] >=20 > You can=E2=80=99t overwrite the var value with a text context = [text]=E2=80=A6[/text] within somefile.inc. >=20 > So, if I do >=20 > [include file=3Dsomefile.inc&var=3D1] >=20 > it is fine. the tag [var] in the included file shows "1" >=20 > but if I do > [text]var=3D2[/text] > [include file=3Dsomefile.inc&var=3D[var]] >=20 > then the tag [var] in the included file shows "[var]" instead of "2" This isn't a simple problem, it goes pretty deep into how WebDNA = retrieves variables. The order of precedence for variable lookups is: 1.) [include] cgi parameters 2.) text variables 3.) math variables 4.) regular cgi parameters (passed via URL or POST) These variables are all kept in separate variable lists, and there is = normally no checking between lists. So you can have a text and a CGI = variable with the same name at the same time. Normally, WebDNA is taking advantage of the fact that regular CGI = parameters are going to be the earliest assignment of any variable, so = they can be treated with lowest priority and it will work correctly. = However, when you do an include, we need to create a new set of CGI = parameters that are treated as highest priority inside of a new context. = This creates all sorts of problems with getting the order of precedence = correct. We decided the best solution is to make all assignments of text = variables delete similarly named CGI parameters in all [include] = contexts. This makes it work correctly even if you include a file inside = of another include. [math] variable assignments though will still be ignored if there is a = conflicting variable passed via an include. [math] variables are already treated as inferior. For example, this code = returns Var=3D4: [text]var=3D4[/text] [math]var=3D1[/math] Var=3D[var] With 8.2, Donovan test shows this output now: Value of VAR from first include: 1 Value of VAR after setting it in first include: 2 Value of VAR from second include: 2 --------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us . christophe.billiottet@webdna.us

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:

WebCatalog Hosting (1996) Navigator 4.01 (1997) date formatting for CC card expiration date check (1998) problems with 2 tags shakur (1997) Sort Order on a page search (1997) Re:no [search] with NT (1997) Cancel Subscription (1996) Fun with dates (1997) Nesting format tags (1997) update on include (1997) docs for WebCatalog2 (1997) Tracking System? (1997) username = 115 (1999) WebMerch/Emailer Error (1998) Doesn't change (WebCat 4.0) (2000) [WebDNA] WebDNA Not Sending Email (2009) DataBaseHelper Flawed (1997) Nesting format tags (1997) nesting limits? (1998) Problems with SELECT MULTIPLE (1999)