views:

55

answers:

1

Background:

I have been running a site on the blogger platform for the past 5 years. I was using the option of hosting the site on my own server, publishing via FTP. My server is running ColdFusion, so I decided to take advantage of that. I created Coldfusion custom tags that provided additional functionality and included those in many of may posts -- to be clear, the body of my posts. Google decided to shut off access to this FTP publishing option. I took that news as an excuse to move to WordPress. Now I have to figure out what to do about all of those ColdFusion tags in my posts.

Problem:

I'd like to not loose the functionality provided by the custom tags I have embedded into my posts. My primary question is what's the best way to add functionality to a PHP site using custom tags? My initial plan was to try parsing the page to find the tags, then write a PHP class to basically mimic the functionality that was provided by the Coldfusion file. I don't know much about PHP, so I'm not sure what tools or libraries are out there to facilitate that. Or if it's just a foolish idea. These are not well formed XML files, so I need something fairly robust.

Example:

I use the following tag:

<cf_taglinks>Tag1, Tag2, Tag3</cf_taglinks> 

to generate a series of <a..>Tag#</a> elements that link to technorati or whatever I decide (thus the benefit of having a custom tag - very easy to change behaviors). The solution for this problem could really be able to handle any link, so if I have a <stackoverflowLink post="3944091"/> tag, I should be able to translate that into

<a href="http://stackoverflow.com/posts/3944091/" 
     target="_blank">Stackoverflow Question: 3944091</a>
+1  A: 

Right now I'm leaning towards the Custom Tags library mentioned in this post as the answer. One of the best features is support for buried or nested tags like the code block below:

<ct:upper type="all">
    This text is transformed by the custom tag.<br />
    Using the default example all the characters should be made into uppercase characters.<br />
    Try changing the type attribute to 'ucwords' or 'ucfirst'.<br />
    <br />
    <ct:lower>
        <strong>ct:lower</strong><br />
        THIS IS LOWERCASE TEXT TRANSFORMED BY THE ct:lower CUSTOM TAG even though it's inside the ct:upper tag.<br />
        <BR />
    </ct:lower>
</ct:upper>

I highly recommend downloading the zip file and looking through the examples it contains.

Snekse
Where was this when [I was looking for a similar system](http://stackoverflow.com/questions/3723752/where-do-i-start-when-writing-a-new-scripting-language)?
EAMann