Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USe CFM Template to produce static page 1

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
GB
I have a page (generate.cfm) that loops through various steps to produce a slection of text output.
At present I use CFINCLUDE to prublish this my main template (index.cfm) however it makes index.cfm very slow to load.

What I would like to do is run the generate.cfm overnight and produce a static page with all the output text and then include that in the main page.

Do this makes sense. I'm sure there must be a way to do it that I just not thinking of.

Cheers
 
Thanks cfSearching maybe need a wee bit more help.
Not sure on the CFHTTP part, not sure what to do with it!
Thanks again
 
It is very simple. Create a page called runGenerate.cfm. Inside the page put a cfhttp call to your 'generate.cfm' page. Then use cfhttp's path and file attributes to save the content to a static html file. (I forgot you don't need to use cffile to save it).

Once you have the page working, set it up as scheduled task to run every night.

Here is an example that grabs the html of this question ;) and saves it to an html file in the same directory. The name of the file is: tek-tips-question-as-html.html

Code:
<cfhttp url="[URL unfurl="true"]http://tek-tips.com/viewthread.cfm"[/URL]
   path = "#ExpandPath('.')#"
   file = "tek-tips-question-as-html.html">
   <cfhttpparam type="URL" name="qid" value="1442939">
</cfhttp>

<!--- debug: show what cfhttp returned --->
<cfdump var="#cfhttp#">

----------------------------------
 
Excellent thanks, nice and simply explained
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top