Forum Moderators: coopster & phranque

Message Too Old, No Replies

Cold Fusion Functionality Question

Would like to universally access a single file from multiple web sites

         

Canton

2:10 pm on Apr 6, 2002 (gmt 0)

10+ Year Member



I'm looking to access a single file, located at a specific location on my Microsoft 2000 server, on multiple web sites so that a single change to that doc will affect all sites "linking" to the page.

I'd like to use Cold Fusion (and a .cfm extension on the page) to do this. Anyone know how this can be done?

It'd be nice if I could use a <cfinclude template = "C:\etc.> but if that's posssible, I haven't figured out how to do it.

Any help is much appreciated.

Thanks,

~Canton

lorax

2:34 am on Apr 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hello Canton,
I'm not sure I understand what you're asking. Are you asking about how to write and include with CF or about how to modify the source file with CF?

Canton

5:41 pm on Apr 7, 2002 (gmt 0)

10+ Year Member



Lorax...
Neither actually. I'm familiar with CF includes, but as far as I've been able to determine, it's possible to access another file in a CF include only through a relative reference(e.g. - <cfinclude template = "universalfile.cfm">)...However, I want the reference to somehow point to a specific file on my server (e.g. - C:\Server\universalfile.cfm). I don't think this can be done with a simple cfinclude, but I know that it can somehow be facilitated, maybe without the use of CF at all.

Still don't know if this makes sense...bottom line, however, is I want to be able to change one page in a single location on my server and have it affect many web sites on the server.

Thanks
~Canton

lorax

1:47 am on Apr 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think I understand what you're asking. You'd like to include a file from outside the web space?

While I haven't used CF in awhile I'm pretty sure you can call pages outside of your web space by using the absolute path. I know PHP will do this quite nicely (I'm a former CF programmer turned PHP programmer). PHP will allow you to include files from anyplace on the server provided you have permission to that dir and file. In fact, I can't think of any scripting language that wouldn't let you do this providing you have permission.

Have you tried entering the absolute path and if so, what did it get you?

Canton

6:57 pm on Apr 9, 2002 (gmt 0)

10+ Year Member



Lorax,

I tried a physical path a URL and got this error message:

----------------
Error Diagnostic Information
Physical paths are not allowed in CFINCLUDE and CFMODULE

The path you have specified 'http://www.website.com/page.htm' is a physical path that points to a specific drive on your system. Only logical paths are allowed in this context. They can be relative (calculated from the current directory of the base template) or absolute (calculated using the ColdFusion mappings).
---------------------

I'm going to look into ColdFusion mappings, but I'm extremely knowledgeable on this issue...any advice on that front?

Thanks in advance
~Canton

justa

5:11 am on Apr 12, 2002 (gmt 0)

10+ Year Member



Have you tried to use the Application.cfm page???

When a user requests any .cfm page the server checks that files folder for Application.cfm. If it finds one it includes it, if not it searches the parent folder. If it is found there it will be used, if not it searches that folders parent folder and so on all the way up your file structure (and it doesn't stop at your web root folder either, it goes right back to the c:\).

Most ColdFusion developers sit a <!--- Commented application page at the web root folder to stop the search going any futher back --->. If you are only serving up on site you are able to use it for items on all pages.

A basic example is if you are using one datasource for all of your querries (you can include more if you use more datasources) In the Application.cfm page include

<!--- This is the root application page --->

<cfset DSN="mydatasource">
<cfset DSN2="myotherdatasource">

Then when you run a query you just put

<cfquery name="myquery" datasource=#DSN#>
and mydatasource is automatically included. If for some reason you change your odbc datasources you only need to update the application page and all queries will be working fine again.

I hope this helps.

***note, you can not request a application.cfm page through the browser either ***

sun818

1:41 am on Apr 15, 2002 (gmt 0)

Filipe

8:27 pm on Apr 30, 2002 (gmt 0)

10+ Year Member



Another option you have it writing a script (on one of the sites on the server) that will take the master script, and CFFILE it over all the other scripts on the system. You can also have this script do a daily update (or however often depending on how often it must be updated) by setting it to run in the ColdFusion Administrator.

webdude

3:21 pm on May 5, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can accomplish this by using a ColdFusion mapping. Using the CF administrator you can specify, for instance /mydirectory/ to be the path c:\blah\blah\. Then you can use it in a cfinclude like: cfinclude template=/mydirectory/myfile.cfm

HTH