Re: [WebDNA] feature suggestion
This WebDNA talk-list message is from 2011
It keeps the original formatting.
numero = 106789
interpreted = N
texte = Missing a closing bracket on the showif below.BillOn Wed, Jun 22, 2011 at 4:58 PM, William DeVaul
wrote:> [!]EXAMPLE USAGE:[var_exists? name=3Dv_id][/!]> [function name=3Dvar_exists?][:global:[name]]![interpret][[name]][/interp=ret][/function]> [!]EXAMPLE USAGE:[var_not_exist? name=3Dv_id][/!]> [function name=3Dvar_not_exist?][:global:[name]]=3D[interpret][[name]][/i=nterpret][/function]>> These return the condition you want in the showif, e.g.:>> [showif [var_exists? name=3Dcritical_var]]> =A0critical stuff> [/showif]>> I like the use of ? that I saw in another post. =A0Can we use ! for the> false result?>> Note that this does not use the brackets around the name of the> variable. =A0Enough with the brackets already!>> Bill>> On Wed, Jun 22, 2011 at 2:38 PM, Aaron Michael Kaczmarek> wrote:>> Years back, someone taught me to do this to find if a variable is>> undefined...>>>> if [myvar]=3D[raw][myvar][/raw] then....>> =A0or>> if [interpret][[myvar]][/interpret]=3D[[myvar]] then....>>>> has always worked perfectly, and I really like the semantics of using th=e>> [raw] tag>>>>>> A new feature added to the [if] tag would be great. =A0maybe behave simi=lar to>> using boolean logic shorthand in javascript if() statements>> for example...>>>> if ( x ) { do something if x exists }>> or>> if ( !x ) { do something if x doesn't exist }>>>> in webDNA could be..>>>> [if ([myVar])][then]....>> or>> [if (![myVar])][then]....>>>>>>>>>> On 6/22/11 2:01 PM, Brian B. Burton wrote:>>>>>> [function name=3D?]>>> =A0 =A0 [If>>> ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][/interpre=t]%5D")&>>> =A0("[url][interpret][[f]][/interpret][/url]"!"")]>>> =A0 =A0 =A0 =A0 [Then][return]T[/return][/Then]>>> =A0 =A0 =A0 =A0 [Else][return]F[/return][/Else]>>> =A0 =A0 [/If]>>> [/function]>>>>>>>>> USAGE:>>>>>> [text]abc=3D123[/text]>>> [!]def is undefined[/!]>>> [text]ghi=3D[/text]>>>>>>>>>
>>>>>> abc =3D [abc]
[? f=3Dabc]>>>>>>
>>>>>> def =3D [def]
[? f=3Ddef]>>>>>>
>>>>>> ghi =3D [ghi]
[? f=3Dghi]>>>>>>
>>>>>> [showif [? f=3Dabc]=3DT]whatever you want to show or execute[/showif]>>>>>> [showif [? f=3Ddef]=3DT]nothing will show or execute[/showif]>>>>>>>>> Brian: I like your use of params_string, cuts out two more letters,>>> rewriting my code now :)>>>>>> On Jun 22, 2011, at 1:31 PM, Brian Fries wrote:>>>>>>> Here's my function for this=85. I return "1=3D0" for false or "1=3D1" =for true,>>>> which makes it simple to use in an IF or a SHOWIF=85 feel free to chan=ge that>>>> if you prefer the T or F returned.>>>>>>>> Additionally it sets the global variable "definedValue" to the value o=f>>>> that variable/field/whatever it is, which is convenient when the targe=t>>>> field name comes from a variable, listwords, etc. (i.e. you don't need= to do>>>> your own [interpret] after the fact)>>>>>>>>>>>> [function name=3DisDefined]>>>> =A0 =A0 =A0 =A0[text]tValue=3D[interpret][[params_string]][/interpret]=[/text]>>>> =A0 =A0 =A0 =A0[if "[url][tValue][/url]"=3D"%5B[params_string]%5D][the=n]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[/t=ext]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D0[/return]>>>> =A0 =A0 =A0 =A0[/then][else]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[tV=alue][/text]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D1[/return]>>>> =A0 =A0 =A0 =A0[/else][/if]>>>> [/function]>>>>>>>>>>>> Example:>>>>>>>> [if [isDefined myVariable]][then]>>>> =A0 =A0 =A0 =A0myVariable is set to [definedValue]>>>> [/then][else]>>>> =A0 =A0 =A0 =A0myVariable is not defined>>>> [/else][/if]>>>>>>>>>>>> Brian Fries>>>> BrainScan Software>>>>>>>>>>>>>>>> On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote:>>>>>>>>> i'm writing it up as a function that returns T/F. I'll post the code =to>>>>> the talk list as soon as I'm happy with it.>>>>>>>>>>>>>>> On Jun 22, 2011, at 1:02 PM, Govinda wrote:>>>>>>>>>>> :-)>>>>>>>>>>>> I would like that too.. =A0but have it apply to any [var] and not on=ly a>>>>>> db [field].>>>>>>>>>>>>>>>>>>> Need a new tag that is a showif if a field exists and is not empty>>>>>>>>>>>>>> i.e.>>>>>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif>>>>>>> [url][content_title][/url]=3D]
[content_title]
[/hid=eif][/hideif]>>>>>>>>>>>>>> too much typing.>>>>>>>>>>>>>> suggestion:>>>>>>> [? [fieldname]] blah blah [/?]>>>>>>> (yeah, I mean literal question marks)>>>>>>>>>>>>>>>>>>>>> Thanks :)>>>>>>>>>>>>>> Brian B.>>>>>> --------------------------------------------------------->>> 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>>>> --------------------------------------------------------->> 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:
Missing a closing bracket on the showif below.BillOn Wed, Jun 22, 2011 at 4:58 PM, William DeVaul wrote:> [!]EXAMPLE USAGE:[var_exists? name=3Dv_id][/!]> [function name=3Dvar_exists?][:global:[name]]![interpret][[name]][/interp=ret][/function]> [!]EXAMPLE USAGE:[var_not_exist? name=3Dv_id][/!]> [function name=3Dvar_not_exist?][:global:[name]]=3D[interpret][[name]][/i=nterpret][/function]>> These return the condition you want in the showif, e.g.:>> [showif [var_exists? name=3Dcritical_var]]> =A0critical stuff> [/showif]>> I like the use of ? that I saw in another post. =A0Can we use ! for the> false result?>> Note that this does not use the brackets around the name of the> variable. =A0Enough with the brackets already!>> Bill>> On Wed, Jun 22, 2011 at 2:38 PM, Aaron Michael Kaczmarek> wrote:>> Years back, someone taught me to do this to find if a variable is>> undefined...>>>> if [myvar]=3D[raw][myvar][/raw] then....>> =A0or>> if [interpret][[myvar]][/interpret]=3D[[myvar]] then....>>>> has always worked perfectly, and I really like the semantics of using th=e>> [raw] tag>>>>>> A new feature added to the [if] tag would be great. =A0maybe behave simi=lar to>> using boolean logic shorthand in javascript if() statements>> for example...>>>> if ( x ) { do something if x exists }>> or>> if ( !x ) { do something if x doesn't exist }>>>> in webDNA could be..>>>> [if ([myVar])][then]....>> or>> [if (![myVar])][then]....>>>>>>>>>> On 6/22/11 2:01 PM, Brian B. Burton wrote:>>>>>> [function name=3D?]>>> =A0 =A0 [If>>> ("[url][interpret][[f]][/interpret][/url]"!"%5B[interpret][f][/interpre=t]%5D")&>>> =A0("[url][interpret][[f]][/interpret][/url]"!"")]>>> =A0 =A0 =A0 =A0 [Then][return]T[/return][/Then]>>> =A0 =A0 =A0 =A0 [Else][return]F[/return][/Else]>>> =A0 =A0 [/If]>>> [/function]>>>>>>>>> USAGE:>>>>>> [text]abc=3D123[/text]>>> [!]def is undefined[/!]>>> [text]ghi=3D[/text]>>>>>>>>>
>>>>>> abc =3D [abc]
[? f=3Dabc]>>>>>>
>>>>>> def =3D [def]
[? f=3Ddef]>>>>>>
>>>>>> ghi =3D [ghi]
[? f=3Dghi]>>>>>>
>>>>>> [showif [? f=3Dabc]=3DT]whatever you want to show or execute[/showif]>>>>>> [showif [? f=3Ddef]=3DT]nothing will show or execute[/showif]>>>>>>>>> Brian: I like your use of params_string, cuts out two more letters,>>> rewriting my code now :)>>>>>> On Jun 22, 2011, at 1:31 PM, Brian Fries wrote:>>>>>>> Here's my function for this=85. I return "1=3D0" for false or "1=3D1" =for true,>>>> which makes it simple to use in an IF or a SHOWIF=85 feel free to chan=ge that>>>> if you prefer the T or F returned.>>>>>>>> Additionally it sets the global variable "definedValue" to the value o=f>>>> that variable/field/whatever it is, which is convenient when the targe=t>>>> field name comes from a variable, listwords, etc. (i.e. you don't need= to do>>>> your own [interpret] after the fact)>>>>>>>>>>>> [function name=3DisDefined]>>>> =A0 =A0 =A0 =A0[text]tValue=3D[interpret][[params_string]][/interpret]=[/text]>>>> =A0 =A0 =A0 =A0[if "[url][tValue][/url]"=3D"%5B[params_string]%5D][the=n]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[/t=ext]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D0[/return]>>>> =A0 =A0 =A0 =A0[/then][else]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[text scope=3Dglobal]definedValue=3D[tV=alue][/text]>>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0[return]1=3D1[/return]>>>> =A0 =A0 =A0 =A0[/else][/if]>>>> [/function]>>>>>>>>>>>> Example:>>>>>>>> [if [isDefined myVariable]][then]>>>> =A0 =A0 =A0 =A0myVariable is set to [definedValue]>>>> [/then][else]>>>> =A0 =A0 =A0 =A0myVariable is not defined>>>> [/else][/if]>>>>>>>>>>>> Brian Fries>>>> BrainScan Software>>>>>>>>>>>>>>>> On Jun 22, 2011, at 10:10 AM, Brian B. Burton wrote:>>>>>>>>> i'm writing it up as a function that returns T/F. I'll post the code =to>>>>> the Talk List as soon as I'm happy with it.>>>>>>>>>>>>>>> On Jun 22, 2011, at 1:02 PM, Govinda wrote:>>>>>>>>>>> :-)>>>>>>>>>>>> I would like that too.. =A0but have it apply to any [var] and not on=ly a>>>>>> db [field].>>>>>>>>>>>>>>>>>>> Need a new tag that is a showif if a field exists and is not empty>>>>>>>>>>>>>> i.e.>>>>>>> [hideif [url][content_title][/url]=3D%5Bcontent_title%5D][hideif>>>>>>> [url][content_title][/url]=3D]
[content_title]
[/hid=eif][/hideif]>>>>>>>>>>>>>> too much typing.>>>>>>>>>>>>>> suggestion:>>>>>>> [? [fieldname]] blah blah [/?]>>>>>>> (yeah, I mean literal question marks)>>>>>>>>>>>>>>>>>>>>> Thanks :)>>>>>>>>>>>>>> Brian B.>>>>>> --------------------------------------------------------->>> 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>>>> --------------------------------------------------------->> 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>>>
William DeVaul
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:
autocommit problem (1998)
Time Tracking (2003)
Practice runs ? (1997)
php vs WebCatalog (2000)
spreadsheet interface (1998)
Nested tags count question (1997)
Possible Bug in 2.0b15.acgi (1997)
Simple Page (2000)
Passing values - never mind (1999)
Grant, please help me ... (1997)
text size limitation (1997)
Separate SSL Server (1997)
errormessages.db (1997)
SQL Ref. (1999)
Upgrading old WebCat Database Files (1997)
[SMSI] WebDNA is too good to go away! (2006)
form data submission gets truncated (1997)
[OT] ImageMagick error (2004)
Nested tags count question (1997)
Accepting credit cards (1997)