[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 waythat keeps my code from being cluttered. I want to include somefunctions conditionally. The file /includes/vendor.inc does exist.First, I tried:[function name=include_if_exists] [showif [fileinfo file=[file]][exists][/fileinfo]=T][return][includefile=[file]][/return][/showif][/function][include_if_exists file=/includes/vendor.inc]That did not work because the functions in the included file were (I'mguessing here) within the namespace of the function"include_if_exists". OK, that makes sense to me but I'm not sure whythe 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]][includefile=/includes/vendor.inc][/showif]What is interesting is that the condition evaluates to "T"="T" andshould include the file. It does not include the file as best I cantell with some text it should display. More importantly, thefunctions in the included file are not available later.I tried a slightly more conventional:[showif [fileinfofile=/includes/vendor.inc][exists][/fileinfo]=T][includefile=/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 toeven show the resulting text if not the functions?Thanks,Bill
Associated Messages, from the most recent to the oldest:
I am trying to include files that define various functions in a waythat keeps my code from being cluttered. I want to include somefunctions conditionally. The file /includes/vendor.inc does exist.First, I tried:[function name=include_if_exists] [showif [fileinfo file=[file]][exists][/fileinfo]=T]
[return][includefile=[file]][/return][/showif][/function][include_if_exists file=/includes/vendor.inc]That did not work because the functions in the included file were (I'mguessing here) within the namespace of the function"include_if_exists". OK, that makes sense to me but I'm not sure whythe 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]][includefile=/includes/vendor.inc][/showif]What is interesting is that the condition evaluates to "T"="T" andshould include the file. It does not include the file as best I cantell with some text it should display. More importantly, thefunctions in the included file are not available later.I tried a slightly more conventional:[showif [fileinfofile=/includes/vendor.inc][exists][/fileinfo]=T][includefile=/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 toeven 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:
WebCatalog NT beta 18 problem (1997)
gateway application timeouts (1998)
ANN: Strategic Partnership with BuyStream Announced. (2000)
Need formum software... (2003)
possible, WebCat2.0 and checkboxes-restated (1997)
Max Record length (1997)
BBEdit and WebCatalog 2.0? (1997)
Generating Report Totals (1997)
Re1000001: Setting up shop (1997)
appleshare/ip (1997)
Summing fields (1997)
[WebDNA] XML Parsing Error Help (2010)
b12 cannot limit records returned and more. (1997)
[SearchString] usage (1997)
Using the sendmail command on CGate Pro (Unix) (2000)
Emailer again (1997)
WebCat2final1 crashes (1997)
Price Change (1999)
WebCat for paper collection, review and coordination ? (1998)
DIsplaying Search Result Relevance (2000)