BlogCFC Tweaks: Post Releaser Scheduled Task
- November 26, 2008 2:34 PM
- BlogCFC
- Comments (0)
I've been slowly accumulating a few tweaks to BlogCFC that make my life a little easier. The first is a schedule task I created to help me with my problem of writing 10 posts one day, but then none for a week.
<cfquery name="qryEntries" datasource="myblogds">
SELECT TOP 1 id
FROM tblBlogEntries
WHERE blog = 'myblogname'
AND released = 0
ORDER BY posted ASC
</cfquery>
<cfif qryEntries.recordCount>
<cfquery name="qryUpdateEntries" datasource="myblogds">
UPDATE tblBlogEntries
SET released = 1,
posted = GETDATE()
WHERE id = <cfqueryparam value="#qryEntries.id#" cfsqltype="cf_sql_varchar" />
</cfquery>
</cfif>
I set this up to run once a day, fairly early in the morning. With this setup, all I have to do is make sure that I mark my posts as not released, and they will be parceled out one at a time to help keep my blog fresh.