[WebDNA] Re: Issue with including functions

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 107069
interpreted = N
texte = Adding the &scope=3Dglobal to the included functions seems to have fixed the first example. The second example was fixed when I removed the extra bracket before [/return]. Thanks for the help. Bill On Tue, Jul 26, 2011 at 2:49 PM, William DeVaul wrote: > OK, I spotted an extra ] in the comparison in the function in the > second item I tried. =A0That now works. > > I'll wager that if I scope to globals, the last one will work too. > > Bill > > On Tue, Jul 26, 2011 at 12:01 PM, William DeVaul wrot= e: >> I am trying to include files that define various functions in a way >> that keeps my code from being cluttered. =A0I want to include some >> functions conditionally. =A0The file /includes/vendor.inc does exist. >> >> First, I tried: >> >> [function name=3Dinclude_if_exists] >> =A0[showif [fileinfo file=3D[file]][exists][/fileinfo]=3DT][return][incl= ude >> file=3D[file]][/return][/showif] >> [/function] >> >> [include_if_exists file=3D/includes/vendor.inc] >> >> That did not work because the functions in the included file were (I'm >> guessing here) within the namespace of the function >> "include_if_exists". =A0OK, that makes sense to me but I'm not sure why >> the included text did not appear either. =A0That part seemed strange. >> >> Then I tried: >> >> [function name=3Dfile_exists?] >> =A0[return]"[fileinfo [file]][exists][/fileinfo]"=3D"T"][/return] >> [/function] >> >> [showif [file_exists? file=3D/includes/vendor.inc]][include >> file=3D/includes/vendor.inc][/showif] >> >> What is interesting is that the condition evaluates to "T"=3D"T" and >> should include the file. =A0It does not include the file as best I can >> tell with some text it should display. =A0More importantly, the >> functions in the included file are not available later. >> >> I tried a slightly more conventional: >> [showif [fileinfo >> file=3D/includes/vendor.inc][exists][/fileinfo]=3DT][include >> file=3D/includes/vendor.inc][/showif] >> >> That "works". >> >> In addition, the other variation that "works" is: >> >> [include file=3D/includes/vendor.inc] >> >> Does anyone have any insight into why the first two examples fail to >> even show the resulting text if not the functions? >> >> Thanks, >> Bill >> > Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Issue with including functions (Govinda 2011)
  2. Re: [WebDNA] Issue with including functions (Donovan Brooke 2011)
  3. [WebDNA] Issue with including functions (William DeVaul 2011)
Adding the &scope=3Dglobal to the included functions seems to have fixed the first example. The second example was fixed when I removed the extra bracket before [/return]. Thanks for the help. Bill On Tue, Jul 26, 2011 at 2:49 PM, William DeVaul wrote: > OK, I spotted an extra ] in the comparison in the function in the > second item I tried. =A0That now works. > > I'll wager that if I scope to globals, the last one will work too. > > Bill > > On Tue, Jul 26, 2011 at 12:01 PM, William DeVaul wrot= e: >> I am trying to include files that define various functions in a way >> that keeps my code from being cluttered. =A0I want to include some >> functions conditionally. =A0The file /includes/vendor.inc does exist. >> >> First, I tried: >> >> [function name=3Dinclude_if_exists] >> =A0[showif [fileinfo file=3D[file]][exists][/fileinfo]=3DT][return][incl= ude >> file=3D[file]][/return][/showif] >> [/function] >> >> [include_if_exists file=3D/includes/vendor.inc] >> >> That did not work because the functions in the included file were (I'm >> guessing here) within the namespace of the function >> "include_if_exists". =A0OK, that makes sense to me but I'm not sure why >> the included text did not appear either. =A0That part seemed strange. >> >> Then I tried: >> >> [function name=3Dfile_exists?] >> =A0[return]"[fileinfo [file]][exists][/fileinfo]"=3D"T"][/return] >> [/function] >> >> [showif [file_exists? file=3D/includes/vendor.inc]][include >> file=3D/includes/vendor.inc][/showif] >> >> What is interesting is that the condition evaluates to "T"=3D"T" and >> should include the file. =A0It does not include the file as best I can >> tell with some text it should display. =A0More importantly, the >> functions in the included file are not available later. >> >> I tried a slightly more conventional: >> [showif [fileinfo >> file=3D/includes/vendor.inc][exists][/fileinfo]=3DT][include >> file=3D/includes/vendor.inc][/showif] >> >> That "works". >> >> In addition, the other variation that "works" is: >> >> [include file=3D/includes/vendor.inc] >> >> Does anyone have any insight into why the first two examples fail to >> even show the resulting text if not the functions? >> >> Thanks, >> Bill >> > 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:

Shopping cart not being assigned (1999) Formvariable won't update (1999) Some shell fun (2004) different browser, different result (2000) Document Contains No Data! (1997) WebCatalog 2.1b3 - Plugin or cgi ? (1997) problem with applets embedded in tpl files (1997) Bad Cookie (1998) Question about replacing words (1998) Updating Prices in Online Database (1999) how to determine the actual file format of an image file? (2002) Order not created error (1997) Business day calculator (2006) 06/06/2000 bug warning ... (2000) [WebDNA] Yikes, upgraded to OS Mavericks and now WebDNA not running (2013) Credit card processing - UK (1997) CC and Europe (1999) shipcost (1997) autosensing lanague selection (1997) Frames and WebCat (1997)