Re: [defined]ish

This WebDNA talk-list message is from

1997


It keeps the original formatting.
numero = 13518
interpreted = N
texte = On the subject of Re: [defined]ish hath scrawled Kenneth Grome:>WebDNA'd pages only look for what you tell them to look for. If >there's a possibility that a particular variable *might* have been >passed or *should* have been passed, then you probably want to look >for that variable unless you're just passing it on to the next page >in the sequence. > >When someone hits the page directly, the [referrer] tag would not >have Macintouch in it (or whatever else you're looking for in the >referrer) so there would be no [referrer] and the test in your showif >context would fail, thus the showif stuff would NOT be executed. > >>Where would the refferer variable be, or how would I deal with >>it being undefined? > >That's why you use [showif] contexts ... to do something special when >the correct referrer is used ... and to NOT do those things when a >different referrer is used.This doesn't really answer the question...let me explain further, using a clearer example. It's oversimplified, but should emphasize my point. I'm trying to deal with variables whose value could never be known to me in advance, and therefore I can't check them against possible values.Let's say you have a page called logon.tmpl. It contains a simple form that prompts you for your name, and will link you to a news page (news.tmpl) that greets you by name. This banal form executes a URL like news.tmpl$showpage?name=[name]The news.tmpl page contains Welcome, [name]! Want some news today, [name]?(Goofy examples are born of simplifications.) However, it's possible that some clever devil might skip the logon page, and simply hit news.tmpl, which would leave the [name] variable undefined. Or rather, WebCatalog wouldn't consider [name] to be a variable at all, despite the brackets.I'd like to be able to trap for such an error, rather than leaving [name] in raw text. However, since [name] could be _any_ name, I simply cannot do a [showif] context for an infinite number of possible names. So I'd like to be able to say [showif [name]=] Welcome, stranger! Why don't you hit logon.tmpl and give me your name? [/showif]I'm aware, though, that in WebDNA, an undefined variable is NOT equivalent to the empty string, but there doesn't seem to be ANY sort of token that an undefined variable _is_ equivalent to. If a variable is undefined, WebCatalog just treats it like a string that happens to have brackets around it.In other words, what I'd like to do seems impossible. Is it?Considering potential problems with making the empty string a standin for undefined, what I'd _like_ to see is a context like [showif [undefined[name]]] You haven't given me your name! [/showif] Make sense?spud. ------------------------------------------------------------------------- a.h.s. boy ---------------------- manifesto overlord, dada typographics spud@nothingness.org ------- http://www.nothingness.org/ Now featuring Social Anarchism and the Situationist International archives J'suis l'enfant de l'etat, et je me bats contre ca Associated Messages, from the most recent to the oldest:

    
  1. Re: [defined]ish (a.h.s. boy 1997)
  2. Re: [defined]ish (Grant Hulbert 1997)
  3. Re: [defined]ish (Christer Olsson 1997)
  4. Re: [defined]ish (a.h.s. boy 1997)
  5. Re: [defined]ish (Kenneth Grome 1997)
  6. Re: [defined]ish (Christer Olsson 1997)
  7. [defined]ish (a.h.s. boy 1997)
On the subject of Re: [defined]ish hath scrawled Kenneth Grome:>WebDNA'd pages only look for what you tell them to look for. If >there's a possibility that a particular variable *might* have been >passed or *should* have been passed, then you probably want to look >for that variable unless you're just passing it on to the next page >in the sequence. > >When someone hits the page directly, the [referrer] tag would not >have Macintouch in it (or whatever else you're looking for in the >referrer) so there would be no [referrer] and the test in your showif >context would fail, thus the showif stuff would NOT be executed. > >>Where would the refferer variable be, or how would I deal with >>it being undefined? > >That's why you use [showif] contexts ... to do something special when >the correct referrer is used ... and to NOT do those things when a >different referrer is used.This doesn't really answer the question...let me explain further, using a clearer example. It's oversimplified, but should emphasize my point. I'm trying to deal with variables whose value could never be known to me in advance, and therefore I can't check them against possible values.Let's say you have a page called logon.tmpl. It contains a simple form that prompts you for your name, and will link you to a news page (news.tmpl) that greets you by name. This banal form executes a URL like news.tmpl$showpage?name=[name]The news.tmpl page contains Welcome, [name]! Want some news today, [name]?(Goofy examples are born of simplifications.) However, it's possible that some clever devil might skip the logon page, and simply hit news.tmpl, which would leave the [name] variable undefined. Or rather, WebCatalog wouldn't consider [name] to be a variable at all, despite the brackets.I'd like to be able to trap for such an error, rather than leaving [name] in raw text. However, since [name] could be _any_ name, I simply cannot do a [showif] context for an infinite number of possible names. So I'd like to be able to say [showif [name]=] Welcome, stranger! Why don't you hit logon.tmpl and give me your name? [/showif]I'm aware, though, that in WebDNA, an undefined variable is NOT equivalent to the empty string, but there doesn't seem to be ANY sort of token that an undefined variable _is_ equivalent to. If a variable is undefined, WebCatalog just treats it like a string that happens to have brackets around it.In other words, what I'd like to do seems impossible. Is it?Considering potential problems with making the empty string a standin for undefined, what I'd _like_ to see is a context like [showif [undefined[name]]] You haven't given me your name! [/showif] Make sense?spud. ------------------------------------------------------------------------- a.h.s. boy ---------------------- manifesto overlord, dada typographics spud@nothingness.org ------- http://www.nothingness.org/ Now featuring Social Anarchism and the Situationist International archives J'suis l'enfant de l'etat, et je me bats contre ca a.h.s. boy

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:

Problems getting parameters passed into email. (1997) RE:DatabaseHelper (1997) WebCat2b13 Mac plugin - [sendmail] and checkboxes (1997) ASP and WebCatalog ?? (2000) Expiration of Carts (1997) includes and cart numbers (1997) Ooops-Serial Number for NT (1997) Need help with [cart] (2000) Return records from another (1997) Version 2.0 and 1.6 simultaneous (1997) Searching multiple fields from one form field (1997) WebCatalog Programmer looking for a new job (2001) Need help with search title (1998) WebCatalog2 Feature Feedback (1996) WC2b15 File Corruption (1997) WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997) Quickie question on the email templates (1997) Webstar 1.3.1 PPC (1997) Forbidden CGI Error (1997) Another bug to squash (WebCat2b13 Mac .acgi) (1997)