David Harris's Technology Blog

ColdFusion, Flex, and other stuff...   (and 341,536 hours, 23 mins in to my plan for global domination)

Search:

Calendar:

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Subscribe:

Enter your email address to subscribe to this blog.

Archives By Subject:

Tags:

action script adobe air ajax cfug coldfusion flash flex frameworks free software fxug general jpgmetadatareader mac off topic opensource papervision spry

Recent Entries:

No recent entries.

Top Posts:

Recent Comments:

Top Commenters:

My Links:

RSS:


Using the BlogCFC5.5 'render' Folder

Here is an example of how to use the 'org/camden/blog/render/' folder in BlogCFC5.5 (and onwards I hope!)
I have a situation where I wanted to reduce typing for http links, so I thought I would write my own renderer for the <a> tag.
The spec was:
- Ignore fully done <a> tags eg:

<a href="http://www.someurl.com">link</a>
- have the ability to disable the Snap preview

Here are the comments from the top of the CFC on how I wanted it to work:

<---

this function will find and <a></a> tags and render them.

The text in the tag is in this format <a>[URL],[Label],SnapPreview(True|false)]</a>

So to use it, do this:

<a>http://www.someurl.com,click here,true</a>

- will render a link to "www.someurl.com" with the text "click here" with the snapPreview (if you using snap...)

<a>http://www.someurl.com,click here,false</a>

- will render a link to "www.someurl.com" with the text "click here" with and without the snapPreview

<a>http://www.someurl.com,click here</a>

- will render a link to "www.someurl.com" with the text "click here" with the snapPreview (if you use snap...) - eg: third value defaults to true

<a>http://www.someurl.com</a>

- will render a link to "www.someurl.com" with the text "www.someurl.com" with the snapPreview (if you use snap...) - eg: third value defaults to true

--->


So to do this, did I need to edit the "blog.CFC"?
NO
All I did was create a CFC called "a.cfc", add to it a function called "renderDisplay" and add my parsing code to it.
I'll attach the CFC to this entry, and I will be the first to admit that the code in there is not my finest moment (I blame the cold I have at the moment!)
But the main point of this entry is to show the functionaliy in BlogCFC to add your own custom tags!

PS: Thanks to Steve Bryant for help with that majic called "regex"!

PPS: the HyperLinks in the entry are rendered by my custom "<a>" renderer!

Related Blog Entries

Comments
I'm glad you are finding it useful. I think you are the only one. ;) I am very proud of the feature, but I'm not quite sure it's ready for prime time - which is one reason I haven't documented it well yet. I'm thinking I'll probably "really" release it in 6.0
# Posted By Raymond Camden | 3/4/07 10:21 AM
It's a great feature, and it feels "right" to be able to customize an application with out having to modify the core files of that app!
I find it great as I keep on coming up with ideas for my blogs that involve custom tags to be rendered!
# Posted By David | 3/4/07 1:37 PM