[WebDNA] Issue with including functions

This WebDNA talk-list message is from

2011


It keeps the original formatting.
numero = 107060
interpreted = N
texte = I am trying to include files that define various functions in a way that keeps my code from being cluttered. I want to include some functions conditionally. The file /includes/vendor.inc does exist. First, I tried: [function name=include_if_exists] [showif [fileinfo file=[file]][exists][/fileinfo]=T][return][include file=[file]][/return][/showif] [/function] [include_if_exists file=/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". OK, that makes sense to me but I'm not sure why the included text did not appear either. That part seemed strange. Then I tried: [function name=file_exists?] [return]"[fileinfo [file]][exists][/fileinfo]"="T"][/return] [/function] [showif [file_exists? file=/includes/vendor.inc]][include file=/includes/vendor.inc][/showif] What is interesting is that the condition evaluates to "T"="T" and should include the file. It does not include the file as best I can tell with some text it should display. More importantly, the functions in the included file are not available later. I tried a slightly more conventional: [showif [fileinfo file=/includes/vendor.inc][exists][/fileinfo]=T][include file=/includes/vendor.inc][/showif] That "works". In addition, the other variation that "works" is: [include file=/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)
I am trying to include files that define various functions in a way that keeps my code from being cluttered. I want to include some functions conditionally. The file /includes/vendor.inc does exist. First, I tried: [function name=include_if_exists] [showif [fileinfo file=[file]][exists][/fileinfo]=T][return][include file=[file]][/return][/showif] [/function] [include_if_exists file=/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". OK, that makes sense to me but I'm not sure why the included text did not appear either. That part seemed strange. Then I tried: [function name=file_exists?] [return]"[fileinfo [file]][exists][/fileinfo]"="T"][/return] [/function] [showif [file_exists? file=/includes/vendor.inc]][include file=/includes/vendor.inc][/showif] What is interesting is that the condition evaluates to "T"="T" and should include the file. It does not include the file as best I can tell with some text it should display. More importantly, the functions in the included file are not available later. I tried a slightly more conventional: [showif [fileinfo file=/includes/vendor.inc][exists][/fileinfo]=T][include file=/includes/vendor.inc][/showif] That "works". In addition, the other variation that "works" is: [include file=/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:

[format 40s]text[/format] doesn't work (1997) What am I missing (1997) Odd Cart Behavior (1997) Windows-based Code Editor (2002) [search] within [listfiles]? (2003) emailer and bad addresses (1997) Parameter Passing (2000) [listfiles] nested in a [loop] (1998) Talk Archives down? (2002) db merge problem (2002) Multiple download orders of the same product? (1997) Forms Search Questions (1997) RE: spawn (1998) special commerce fields (1997) OT: Connecting Sprout and WebDNA (2008) Security (1998) WebCatalog can't find database (1997) Kaaaaahhhhhhhnnnnnnn! (1997) too many nested [xxx] (1997) [OT] DOD again (2003)