BlogCFC Tweaks: Post Releaser Scheduled Task

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.

 

Comments

Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one. authenticjobs.com

Interested in becoming a sponsor? Contact me.