Remember Me

Tags: BlogCFC
Word Count: 57

A couple people pointed out that the remember me feature was not working. I have cleared up this issue and should not be a problem going forward. When I switched to inline comments I forgot to populate the fields with form.x and those values get loaded from a cookie if the cookie is present.


Maximum and Minumum Height in IE

Tags: CSS,BlogCFC
Word Count: 457

While re coding my site I have come across many IE bugs that I been forced to learn about. The max and min bug is just another example of IE6 not playing well with others. Fortunately they fixed this in 7 and should only affect 6 and below. The min and max height (and width for that matter) allow you to set minimum and maximums for an element. I actually use this for my code view. In BlogCFC everything you put in between code tags gets parsed out in a .code block. When you have very little code there is no problem but what happens if you have 300 lines of code in your example? You don't want it taking up your whole page do you? The answer is no, so you can set a max-height property for the code div. This is the css code for my code block.

.code {
   font-family:courier new;
   font-size:12px;
   color: black;
   border: solid thin #bc5e1f;
   background-color: #f3f3f3;
   overflow: auto;
   max-height: 200px;
   padding: 4px;
   line-height: 15px;
   margin:5px 0;   
}

This works great in Firefox and IE 7 but IE6 does not recognize min and max height values so it shows all of the code. This is where expressions come into play.CSS expressions were introduced in Internet Explorer 5.0 and it allows you to to assign a JavaScript expression to a CSS property. This is a great way to correct this problem because no other browser will see our expression. We still can not use a max-height property but we can set the height of this div. All this expression does is evaluate the height of the element, if it is greater than 200 pixels it sets the height to 200.

height: expression(this.scrollHeight > 200 ? "200px" : "auto"); /* IE */

Firefox and IE7 will rely on the max height while IE6 will see height property. The only downfall to expressions is that they will fail if JavaScript is turned off. All in all I think it is an easy fix for our problem.

BlogCFC Author Comments

Tags: BlogCFC
Word Count: 289

One common design technique you will see on blogs is the distinct separation between a user comment and an author comment. Just by taking a quick glance at a group of comments you should be able to see where the Author has responded. In BlogCFC this is snap to do and I want to walk you through how I did it on my blog. Here is a quick snapshot of what my comments look like now in case they change in the future.

This first thing we need to do is setup our structure for our css. I took this completely out of the code so you could see it raw. You will notice that we have a container for all comments (comments) along with a comments section header (h3). Next we have a container for individual comments (comment). Each comment will have a head (commet-head) that contains information like the current comment number, the posters name and when the comment was posted. Finally each comment will have a body (comment-body) which is the actually comment. When we have multiple comments the single comment will just repeat itself.

<div id="comments">
<h3>Comments</h3>
<div class="comment">
   <div class="comment-head">
      #1 Posted By: Jake Munson Posted On: 12/29/07 11:13 AM
   </div>
   <div class="comment-body">
      My problem with services like this is they just give you a snapshot of your site. I am usually worried about how JavaScript works, so these services are useless for that.
   </div>
</div>
</div>

[More]

BlogCFC Survey

Word Count: 65

Ray Camden released a second survey for BlogCFC. Anyone who reads this blog already knows I am a BlogCFC supporter. Please take a second to fill out the survey and help with input on the next version. It will not take you that long and really helps Ray with what development time should be spent on.

BlogCFC Survey #2

BlogCFC - Counting Words in an entry

Word Count: 242

I thought I would add a quick feature to my blog today. I wanted to be able to display the number of words per post. This was way easier than I thought it would be and it was mainly because of the power behind Regular Expressions. I am still new to regex so this may not be completely right but it works so I am going with it. To add this feature to your blog you have to add 1 line in your index on the same line where it displays the date and tags, here is the code.

<cfoutput>| Word Count: #application.blog.getWordCount(body)#</cfoutput>

Then you need to add the following function to the main BlogCFC Component. All we are doing here is reading the entry text, stripping the html tags and counting the words using Java's String method split. The split method actually returns an array of words so a quick arrayLen() will give us the count we are looking for.

<cffunction name="getWordCount" access="public" output="true" returntype="numeric">
   <cfargument name="str" type="string" required="true">
   <cfset var stripped = REReplace(arguments.str, "<.*?>", "", "all")>
   <cfset var words = stripped.split('\W')>
   <cfreturn arrayLen(words)>
</cffunction>

Finally just clear the cache by appending ?reinit=1 to the url.


BlogCFC: Removing lastXDays feature

Tags: BlogCFC
Word Count: 415

In a previous entry I showed you how could change the default value for number of days to show entries. Well after hearing others thoughts about this, especially Charlie Arehart, this feature really does not make much sense and from everything I read Ray agrees. The reason this feature does not make much sense is because there is already a feature to display last x entries. There is no reason to go any further than this. Let us say that you are a blogger who posts entries 5 times a day or someone who posts 5 times a month, using the last x entries feature will work for both of them. This will also help cut down on going to blog and seeing the dreaded "Sorry there are no blog entries".

With that being said I would like to remove this feature from blogCFC. Fortunately you may not realize this but its as easy as removing 1 digit from the code. If you goto the tags folder and open the getMode.cfm template you will see the following code towards the bottom.

<!--- For default view, limit by date and max entries --->
<cfset params.lastXDays = 30>
<cfset url.mode = "">

In the end this is a part of a paramter structure that gets passed to the getEntries() method of the component org.camden.blog.blogcfc. Here is the part of the getEntries method that we are interested in.

<!--- If lastXDays is passed, verify X is int between 1 and 365 --->
      <cfif structKeyExists(arguments.params,"lastXDays")>
         <cfif not val(arguments.params.lastXDays) or val(arguments.params.lastXDays) lt 1 or val(arguments.params.lastXDays) gt 365>
            <cfset structDelete(arguments.params,"lastXDays")>
         <cfelse>
            <cfset arguments.params.lastXDays = val(arguments.params.lastXDays)>
         </cfif>
      </cfif>

Basically this code is looking for a value between 1 and 365 if it does not find a valid value it deletes the structure key. If the structure key is not there this feature is not used. So how do you remove the feature? Simply go back to the getMode.cfm template and change the lastXDays paramater to 0.
<!--- For default view, limit by date and max entries --->
   <cfset params.lastXDays = 0>
   <cfset url.mode = "">
And there you have it, even if you write 1 entry per month your home page will display entries based on the last x entries setting in your admin.

BlogCFC hides old entries, how to change that.

Word Count: 446

Dan Lancelot was having an issue with BlogCFC. He visited his blog and saw the text "Sorry There are not blog entries". This was mainly to do with his lack of posts in the last 30 days. By default BlogCFC will show the last 30 days entries along with the max number of entries which is set in your BlogCFC settings file. If you are someone who does not post as frequently and you want to change the 30 day default to say 60 or 90 days. To change this go to tags > folder and edit the getMode.cfm template. At the bottom of this template you will see the following code. If you change the lastxdays variable you can have BlogCFC search further back.

   1:  <cfset params.lastxdays = 30>
   2:   
   3:  <cfset params.lastxdays = 90>

One other alternative which Dan brought up is to make an effort to post more articles which is exactly what I have been trying to follow.

BlogCFC Evangelist Rumors

Word Count: 220

Brian Rinaldi over at www.remotesynthesis.com published his open source update for July 2 and can found here. Brian was kind enough to mention a bunch of my BlogCFC tutorials that I was working on. He also lead his readers to believe I was a paid BlogCFC evangelist. While I would gladly except this position sadly it is not true. If Ray Camden is not getting paid for his work I hardly doubt there are any openings for me.

In all seriousness though BlogCFC is a great product and I enjoy using it everyday. I know Brian was having fun with it but open source projects live because of the great work put forth by the developers and by the community. Contributing to an open source project does not mean that you need to dig into the code and start making modifications or additions. Most of the time developers need help with graphics, documentation, spreading the word & at the very least getting others excited about it. So the next time you feel like giving back to a project take a few minutes and write up a quick tutorial, its the least you can do to support the projects we all use everyday.

blogcfc_195

How Old Is Ray Camden?

Word Count: 387

First off I have never had the chance to meet Ray Camden in person but by the looks of his pictures and his love of video games he seems to be a younger guy. The reason I raise this question is because I was looking at a template that is a part of BlogCFC. The template in question can be found in the folder tags and the name of the file is textarea.cfm. If we look at the document header we see the following text. I know he is a little older than me but and I don't remember that far back but punch cards my friend? Those must have been tough times.

<!---
 Name         : textarea.cfm
 Author       : Raymond Camden
 Created      : July 11, 2006
 Last Updated : September 15, 2006
 History   : Use id (rkc 9/15/2006)
 Purpose : Makes it easier to add a Rich Text Editor, for you wimpy folks who can't write html by hand.
              : I tell ya - in my day, we wrote our HTML by hand and we liked it gosh darnit. We didn't even
              : have monitors. We had to write our HTML with punchcards. And our punchcards were made of tissue
              : paper and would break if you didn't write it exactly right.
--->

Publish BlogCFC Entries Using Google Docs

Word Count: 485

I posted some articles on how to use Windows Live Writer to create blog posts in BlogCFC. If you are not on Windows or just do not want to use that software I have another solution for you, that's right Google Docs & Spreadsheets. I make no secret of how big a fan I am of Google Office. I don't just use it for keeping articles entries but the office suite itself helps me keep my life organized. If you are BlogCFC user (why would you not be) or really any blog that support XML-RPC this should work for you. If you do not understand how XML-RPC allows you to post articles to your blog check out this article I wrote earlier.

First off you will notice that a lot of people in the ColdFusion community are getting hooked on Google Docs. This is really a great way to share information with others. I know that Matt Woodward has been using them extensively and has been using them to post all of his CFUnited notes. I will quickly share with you how my setup for blogging is and then we can get into setup. Recently Google Docs added folders which allows for better organizing of content. I created a folder called Blog Articles. Inside of this folder I created a year folder for 2007 and will create a new come the new year. Inside the 2007 folder I have also created June, July & August folders. I do not post thousands of post like others but I think this is a good orginization tip for future searching. Finally in each month I have a file called "Article Ideas". This is a scratch pad for future posts. When I come up with a post I will start a new document and create some bullet points. I believe this approach is good because if you have something started you will likely want to finish it at some point. Enough of how I like to waste time, lets go ahead and get setup.

1. To publish articles from Google Docs simply click on the Publish button in the upper right corner.
2. Click on change your blog site settings.
3. Edit Your Settings



Use the settings above with your username and password and you should be ready to go. You will also notice the last line, you can automatically set the category of the entry by tagging your documents with a category name that you use on your site. I will have to check into this but I do not think this case sensitive.




More Entries

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.