EasyCFM.COM ColdFusion Forums / Good Coding Tips! / storing variables

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: storing variables

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

TiGGi
03-05-2009 @ 12:19 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Sep 2003

Hi all,

I am just wondering what would be the optimal way of storing variables that are used throughout the site.
You now like if I want to set default page title, or maybe a default number of records per page...

Application.cfc/cfm?
Database?
flat text configuration file?
Other?

kicker
03-05-2009 @ 12:32 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 717
Joined: Oct 2004

It depends greatly. What you need to ask yourself is how often are these variables going to change. If they are going to change often say once a month or maybe every other month or what have you what would be the easiest and cost effective way for you to do that. I would say a database instead of pulling the application file or another file and having to rework it then upload it. If you have no plans on changing it then the application file should do well or where ever. Make sense? Hope that helps.

Craig
"Nothing great in the world has been accomplished without passion." — Georg Wilhelm Friedrich Hegel, German philosopher (1770-1831).

TiGGi
03-05-2009 @ 1:29 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Sep 2003

I see what you're saying but I don't think that would be an issue.  I was planing of having a management page which would either generate a configuration file or insert the settings into dB.  My main concern is the performance.  I know any of these will work and I know how to do them, I was just wondering about the best way of doing it.

kicker
03-05-2009 @ 1:35 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 717
Joined: Oct 2004

If you have a fast database (not MS Access) then the database would be a little slower than an application file. You would have to pull the data then read it and run it. Where as if you have it in the application file then you can just run it directly without having to assign the values based on the database. Pulling a file would be even slower. So performance wise its best to hard code it in the application file cause its pulled once for each application session. Then the database as long as it is a good one. Then a file.

Craig
"Nothing great in the world has been accomplished without passion." — Georg Wilhelm Friedrich Hegel, German philosopher (1770-1831).

TiGGi
03-05-2009 @ 1:49 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 44
Joined: Sep 2003

Thanx for your help, I suspected that much.

cheers

StoneRose
05-02-2010 @ 4:00 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Junior Member
Posts: 80
Joined: Dec 2008


I do it with a bunch of these...

<cfif NOT ISDEFINED("client.numberofpages")>
   <cfset client.numberofpages = 5>
</cfif>





Website Designed and Developed by Pablo Varando.