Re: [WebDNA] showif with empty variable
This WebDNA talk-list message is from 2015
It keeps the original formatting.
numero = 112181
interpreted = N
texte = I like your IsSet, but=E2=80=A6I was amazed when I figured out you could use a single punctuation mark =as a function name so I had to do it. It=E2=80=99s easy to type (4 less =letters!) and avoids that whole annoying issue when you have to make =your function names international (example: in Canada IsSet becomes =SetEh )A few years ago I learned (and have since mostly forgotten) Ruby on =Rails. The thing that frustrated me most about that language/framework =is how =E2=80=9Cmagical=E2=80=9D it is. Code works or doesn=E2=80=99t =work based on it=E2=80=99s context. It kind of ruins the readability of =the code, because code that works in one place, won=E2=80=99t work in =another because it=E2=80=99s out of context which isn=E2=80=99t very =well documented because DUH, you=E2=80=99re just supposed to know how it =works (well, that=E2=80=99s the feeling I got from the developer =community)=20Anyway, [showif [IsSet selector]] vs. [showif [? selector]=3DF]. The =first changes the way people expect to see a showif. The 2nd is more =readable and accessible if someone else has to maintain the codebase =someday.Just my two cents, this isn=E2=80=99t a criticism, I just enjoy open =discussion to find the optimal solution to any given problem :)-Brian B.> On Mar 14, 2015, at 11:48 AM, Donovan Brooke
wrote:>=20> Nice Brian! we think alike.>=20> On looking at my IsSet function, which is similar to yours..=20> I do rather:> [then]T=3DT[/then]> [else]T=3DF[/then]>=20> This makes my call look something like this:>=20> [showif [IsSet selector]]> [include file=3Dblank_page.inc]> [/showif]>=20> Sincerely,> Donovan>=20>=20>=20>=20> On Mar 13, 2015, at 7:33 PM, Brian Burton wrote:>=20>> This is what I use>>=20>> [function name=3D?]>> [!] return T/F based on if a field exists and has a value[/!]>> [!] incoming variables: the name of the field to be tested i.e. [? =field] [/!]>> [If =("[url][interpret][[params_string]][/interpret][/url]"!"%5B[interpret][par=ams_string][/interpret]%5D") & =("[url][interpret][[params_string]][/interpret][/url]"!"")]>> [Then][return]T[/return][/Then]>> [Else][return]F[/return][/Else]>> [/If]>> [/function]>>=20>> usage: [showif [? selector]=3DF] [include blank_page.inc] [/showif]>>=20>>=20>>=20
Associated Messages, from the most recent to the oldest:
I like your IsSet, but=E2=80=A6I was amazed when I figured out you could use a single punctuation mark =as a function name so I had to do it. It=E2=80=99s easy to type (4 less =letters!) and avoids that whole annoying issue when you have to make =your function names international (example: in Canada IsSet becomes =SetEh )A few years ago I learned (and have since mostly forgotten) Ruby on =Rails. The thing that frustrated me most about that language/framework =is how =E2=80=9Cmagical=E2=80=9D it is. Code works or doesn=E2=80=99t =work based on it=E2=80=99s context. It kind of ruins the readability of =the code, because code that works in one place, won=E2=80=99t work in =another because it=E2=80=99s out of context which isn=E2=80=99t very =well documented because DUH, you=E2=80=99re just supposed to know how it =works (well, that=E2=80=99s the feeling I got from the developer =community)=20Anyway, [showif [IsSet selector]] vs. [showif [? selector]=3DF]. The =first changes the way people expect to see a showif. The 2nd is more =readable and accessible if someone else has to maintain the codebase =someday.Just my two cents, this isn=E2=80=99t a criticism, I just enjoy open =discussion to find the optimal solution to any given problem :)-Brian B.> On Mar 14, 2015, at 11:48 AM, Donovan Brooke wrote:>=20> Nice Brian! we think alike.>=20> On looking at my IsSet function, which is similar to yours..=20> I do rather:> [then]T=3DT[/then]> [else]T=3DF[/then]>=20> This makes my call look something like this:>=20> [showif [IsSet selector]]> [include file=3Dblank_page.inc]> [/showif]>=20> Sincerely,> Donovan>=20>=20>=20>=20> On Mar 13, 2015, at 7:33 PM, Brian Burton wrote:>=20>> This is what I use>>=20>> [function name=3D?]>> [!] return T/F based on if a field exists and has a value[/!]>> [!] incoming variables: the name of the field to be tested i.e. [? =field] [/!]>> [If =("[url][interpret][[params_string]][/interpret][/url]"!"%5B[interpret][par=ams_string][/interpret]%5D") & =("[url][interpret][[params_string]][/interpret][/url]"!"")]>> [Then][return]T[/return][/Then]>> [Else][return]F[/return][/Else]>> [/If]>> [/function]>>=20>> usage: [showif [? selector]=3DF] [include blank_page.inc] [/showif]>>=20>>=20>>=20
Brian Burton
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:
How far do [showif]s go? (1997)
Using Cookie for client specific info? (1997)
WC2b15 File Corruption (1997)
WCS Newbie question (1997)
switching users (1998)
WebCat2b13MacPlugIn - [include] doesn't allow creator (1997)
WebCat2 several catalogs? (1997)
Unexpected error (1997)
[item] appears after 'remove last item' ... (1997)
WebCat Ad! (2000)
WebCatalog f2 Installation (1997)
Announcement-WebCatalog 2.0 Released (1997)
[WebDNA] Apache .htpasswd (2014)
Weird happenings (1998)
Using Communigate Pro on Mac OS X Server (2000)
emailer setup (1997)
WebCatalog2 Feature Feedback (1996)
Stumpted Again (1997)
WebCatalog can't find database (1997)
AuthorizeNet setup -- progress but still need input from experts! (2000)