• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF Code in CFFile created pages?

Guest
Jun 04, 2006 Jun 04, 2006

Copy link to clipboard

Copied

I've hit a brick wall here, so would gladly appreciate some input!

I'm trying to automate, as much as possible, the creation of 'sub sites' under a domain. At the moment, the directory is created using CFDirectory and the static files (images, css docs etc) are copied into it. However, I need to be able to set the datasource specific to the sub-site - which I had planned to do within the application.cfm file.

I can get CFFile to create the application.cfm file, and put it in the right place, but the actual file itself is empty.

All I need the application.cfm file to contain is <cfset datasource="blah"> (for the time being at least, but once I solve this issue I'll be able to address anything else I need to add later).

Now, I have 2 problems here -

Firstly, I need the CFFile to actually write the code into the application.cfm file - at the moment it just executes, and therefore produces a blank page. Secondly, the 'blah' part I need to actually be executed, because the actual datasource name I want to write into the page will be determined by the page that is running the cffile (and getting the variable from a form the page before).

Hope that makes sense, but if anyone else can suggest a better method for doing this, I'm all ears!
TOPICS
Advanced techniques

Views

368

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2006 Jun 04, 2006

Copy link to clipboard

Copied

Create the folder C:\CFusionMX7\wwwroot\clientSite\ and run

<cfset app_cfm_content = "<cfapplication name=""apptest""
clientManagement = ""yes""
setClientCookies = ""yes""
setDomainCookies = ""no""
loginStorage = ""session""
sessionManagement = ""yes""
sessionTimeout = ""#CreateTimeSpan(0,0,10,0)#""
applicationTimeout = ""#CreateTimeSpan(1,0,0,0)#"">
<cfset datasource = ""blah"">
<cferror type=""exception"" exception=""any"" template=""error_page.cfm"" mailto=""me@medomain.com"">">
<cffile action="WRITE" file="C:\CFusionMX7\wwwroot\clientSite\Application.cfm" output="#app_cfm_content#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2006 Jun 05, 2006

Copy link to clipboard

Copied

That worked a treat, thanks for your help - much appreciated!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2006 Jun 05, 2006

Copy link to clipboard

Copied

LATEST
!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation