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:

Error Lob.db records error message not name (1997) ReturnRaw and redirect (1997) My slower response (1997) Good vs. Bad; also [setHeader] (2002) Serving images from databases (1998) Unique SKU Numbers (2000) same product in cart (1997) Forms Search Questions (1997) Re:PCS Customer submissions ? (1997) read and write you own cookies with webcat (1997) serial number dishing (1997) populating a table from multiple cookies (2005) Sendmail and textarea (1998) Smart caching problems with 2.1b3? (1997) Separate SSL Server (1997) Can you do this??? and other stuff (1997) Help name our technology! (1997) WebCat2 beta 11 - new prefs ... (1997) E-mailer error codes (1997) changing creator codes (2000)