|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Generating pages off database dynamically
sup ppl,
how would I generate 'static' pages off database on demand in coldfusion? for example, when user clicks on a link, it will take the user to a page named after the row number of the entry in the database table, e.g. 189.cfm or 200045.cfm, etc... and these pages being generated on demand? then maybe cached for 10-20 minutes and save space? am I thinking too hard? ![]() Is it as simple as using cffile tag? |
|
#2
|
||||
|
||||
|
Yes, you can use <cffile action="write"> for this along with the required parameters.
As for writing cfm files, you may encounter issues if you want to include CF tags, although I think it will still work since you're pulling from a database and CF should then ignore them. In these sort of situations, it really is easier to use URL variables. But if you really want that, it's very do-able. Hope that helps. |
|
#3
|
|||
|
|||
|
You can use cffile to write static HTML files. You can also cache the query results using <cfquery> or caching data into the session or application scopes.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#4
|
|||
|
|||
|
i see..
what if there will be thousands of pages? I'm wondering if going this route will be easier on the server, and faster for users, than to have a handful of pages getting all the hits... |
|
#5
|
|||
|
|||
|
The real question is, do you need to do this? Is your traffic high enough that you have determined that using dynamic CF pages is too slow, and that you need to generate static HTML pages instead? Yes, static HTML pages are served faster than CF pages because CF isn't doing anything, but the difference is rather small and unless you're under a very heavy load I doubt it would make much of a difference, assuming that you have a decent server, a decent database, and properly written SQL and CFML code.
|
|
#6
|
|||
|
|||
|
ah...
kiteless, do you recommend any book or an article on the web that may discuss something of this nature? thnx! |
|
#7
|
|||
|
|||
|
I can't give a specific recommendation, but I believe Ben Forta's book at least touches on this topic. In reality, the best thing to do would be to try it yourself. Something like this:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Generating pages off database dynamically |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|