> James Sleeman wrote:
> | There is another thread running on this at the moment, see "templates
held
> | in database".
> |
> | To answer your question though, write the content from your database to
a
> | temporary file using CFFILE, then use <CFINCLUDE> to include that
> file, then
> | delete the temporary file...
>
> but this approach is flawed with cfmx as the first hit on a template s
> slow as it is compiled in to java byte code..... :-(

That is correct, hence why you don't want to rewrite the file each time you
need it.  If you only pull it out of the database when it changes then CF
will compile it only once per change...  easy way to do this is to name the
file as the hash of the content eg...

<CFSET Filename = Hash(fromDatabase) & ".cfm">
<CFLOCK ...>
<CFIF NOT FileExists(ExpandPath(FileName))>
    ... write out the file ...
</CFIF>
</CFLOCK>
<CFINCLUDE TEMPLATE="#FileName#">

Lock around the file writing of course to stop 2 threads trying to write it
at the same time if it doesn't exist.  You probably want to clean up the
files every now and then (just delete any older than x days when the app
fires up or something).

---
James Sleeman

Innovative Media Ltd
Ph: (03) 377 6262
http://www.websolutions.co.nz

CAUTION:  The information contained in this email message is confidential
and may be legally privileged.  If the reader of this message is not the
intended recipient you are notified that any use, dissemination,
distribution or reproduction of this message is prohibited.  If you have
received this message in error please notify the sender immediately and
destroy the original message and any attachments.

Views expressed in this communication may not be those of Innovative Media
Ltd.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 6/21/2002

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to