blogCFC mod for easy WOWWiki linking!

If you use Ray Camden's blogCFC, you can add this block to make WoW item/boss/whatever linking easier. In blog.cfc, around line 2088, renderEntry, is some code to format a code entry. Add a block after that to render a different sort of code.

<cfif findNoCase("[wow ",arguments.string) and findNoCase("]",arguments.string)>
   <cfset counter = findNoCase("[wow ",arguments.string)>
   <cfloop condition="counter gte 1">
<cfset codeblock = reFindNoCase("(?s)(.*)(\[wow )(.*)(\])(.*)",arguments.string,1,1)>
      <cfif arrayLen(codeblock.len) gte 6>
<cfset codeportion = mid(arguments.string, codeblock.pos[4], codeblock.len[4])>
         
         <cfset result = "<a href='http://www.wowwiki.com/#codeportion#' target='_blank'>#codeportion#</a>">
         <cfset newbody = mid(arguments.string, 1, codeblock.len[2]) & result & mid(arguments.string,codeblock.pos[6],codeblock.len[6])>

<cfset arguments.string = newbody>
         <cfset counter = findNoCase("[wow ",arguments.string,counter)>
      <cfelse>
         <cfset counter = 0>
      </cfif>
   </cfloop>
</cfif>

Now when making a blog post, I can type

[wow Light Feather]

and it will render as

Light Feather

Woo! Time savings, ftw

Related Blog Entries

Comments
Now you just need to add one for the hover preview and it will be perfect!
# Posted By joshua | 4/28/08 4:12 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner