A question came my way today about Ray Camden’s BlogCFC and I hope I’m not stepping on Ray’s toes by answering it. Someone wanted to know how to configure the default entries that show up. Some of his were dropping off after a certain time frame and he wanted to increase the default time frame. So, here’s how it’s done…
Blog.cfc in org/Camden/blog in the blog’s install folder has a function getEntries() which takes a ‘params’ structure. The ‘params’ structure is passed to the function in index.cfm of your blog instance. Here’s that code:
<cftry>
<cfset articles = application.blog.getEntries(params)>
<!--- if using alias, switch mode to entry --->
<cfif url.mode is "alias">
<cfset url.mode = "entry">
<cfset url.entry = articles.id>
</cfif>
<cfcatch>
<cfset articles = queryNew("id")>
</cfcatch>
</cftry>
So, you might be asking how does ‘params’ get set up? Look in /tags/getmode.cfm. You will notice that it checks for several url params which allow you to get entries for just a certain month, day or by way of a search. The default (line 64-68 in my file) is this:
<cfelse>
<!--- For default view, limit by date and max entries --->
<cfset params.lastXDays = 30>
<cfset url.mode = "">
</cfif>
So, there’s your answer. It is getting the entries from the last 30 days. Change that and you’ll change what shows up by default.
Oh yeah, the queries all get cached as well so you won’t immediately see your change. Pass a url param ‘reinit=1′ and you’ll re-initialize the application scope.
Happy blogging!

Related Articles
No user responded in this post
Leave A Reply