This may be better off at BlogCFC.com, but I've had a few requests for this lately so I thought I'd post it here.
One of the undocumented features of BlogCFC is the ability to pass in configuration information to the CFC. Normally you tell the CFC to load data from the INI file. However, you may want to create a completely dynamic setup. For example, maybe you want x.foo.com and y.foo.com to both run BlogCFC and both use one physical folder.
This is rather simple - but you have to pass a structure that contains all the keys that would normally be in the INI file. Here is an example I'm using on a real site now (unreleased to the public though). First - here is the code that sniffs the server name to grab the name of the blog, in this case it is based on the first part of the URL. If we were using x.foo.com and y.foo.com, the blog names would be X and Y.
<cfset blogname = listFirst(cgi.server_name,".")> <cfapplication name="_blog_#blogname#" sessionManagement="true" loginStorage="session">
Next I create a structure with all values that exist in a normal INI file:
<cfset instance = structNew()> <cfset instance.dsn = dsn> <cfset instance.owneremail="email@example.com"> <cfset instance.blogurl = "http://#cgi.server_name#/blog/index.cfm"> <cfset instance.blogtitle = "#blogname# Blog"> <cfset instance.blogdescription = "#blognme# Blog"> <cfset instance.blogDBType="MYSQL"> <cfset instance.locale="en_US"> <cfset instance.users = ""> <cfset instance.commentsFrom = ""> <cfset instance.mailServer = ""> <cfset instance.mailUsername = ""> <cfset instance.mailPassword = ""> <cfset instance.pingurls = ""> <cfset instance.offset = "0"> <cfset instance.allowtrackbacks = false> <cfset instance.trackbackspamlist="lots of bad words here"> <cfset instance.blogkeywords = ""> <cfset instance.ipblocklist = ""> <cfset instance.allowgravatars = true> <cfset instance.maxentries = "10"> <cfset instance.usecaptcha = false>
Once you have the structure populated, you then pass it to the CFC:
<cfset application.blog = createObject("component","org.camden.blog.blog").init(blogname,instance)>
That's it. Obviously you may need to tweak your instance settings. For example, you may have special logic for the users value. Anyway, let me know if this doesn't make sense.