Marcos Placona Blog

Programming, technology and the taming of the web.

Category: Mango Blog (page 1 of 2)

All of the posts related to this wonderful blogging engine powered by ColdFusion

Migrating Mango Blog to WordPress

Reading time: 5 – 8 minutes

Migration in actionPhoto by: gagilas

As previously promised, today I’ll be publishing my migration scrips from Mango Blog to WordPress.

As mentioned previously, I wrote this script entirely for my own benefit, so please excuse me if it doesn’t meet your expectations. It has only been tested on mySQL, but should run on other SQL engines without major updates.

The script is supposed to deal with all the posts and comments, and will convert code snippets that use the SyntaxHighlighter plugin (by Tony Garcia) into the default Alex Gorbatchev‘s SyntaxHighlighter style. So the only thing you will need to do, is install a WordPress plugin that can deal with the tags. I’m using a plugin called SyntaxHighlighter Evolved, and am very happy so far.

It will also make sure all the categories are adequately created and asigned to your posts as they are created, so you won’t have to manually create them, or import them in a separate batch. Categories in WordPress a very tricky, and it took me a great deal of time to understand exactly how they are stored, and how the relationships work, so this should save you a long time on the migration.

I’ll briefly explain the script’s functionality here, but the comments on the code should be enough ro help someone trying to extend it, or even make it work with other blogging engines.

There is only one file responsible for the actions, and as long as the right method is called (batchPostWordpress), everything should happen automatically, and your posts, along with comments and everything else will be migrated. The only thing this script does not deal with, are the images, but as you should already be using only image paths (i.e. you are not storing anything on the database), your images should still work as long as they are stored on the right path. In my case, as I normally store images on a separate server, I wouldn’t have to worry about that.

Step ONE:

You must have two ColdFusion DSN’s on your server. One is for the current Mango Blog, and another for the new WordPress install. Obviously your WordPress won’t be using this DSN after you have migrated, but as this is a ColdFusion script, and you will be using ColdFusion to migrate your content, you will need a DSN created on your ColdFusion server.

In my case, I was “creative”, and called one mango (pointing to the mangoblog datrabase) and another one wordpress (pointing to the wordpress database). No rocket science up to here as you can see.

Step TWO:

Download the files, and extract them to your ColdFusion root, or anywhere where you can execute CFML files. For this example, I’m executing everything from ColdFusion’s root ( OR localhost).

Having the files in there, open runner.cfm, and change the variables mango_dsn and wordpress_dsn to suit your needs. Mine looks like this:

<cfset posts = createObject("component", "PostManager").init	(
											mango_dsn : 'mango',
											wordpress_dsn : 'wordpress'
											) />

On the next lines, you will find the following:

<cfset qPosts = posts.batchPostWordpress(
									start 	: 0,
									limit 	: 100
										) />

This pretty much says everything. It’s calling the method batchPostWordpress and processing posts in batches of 100 posts. I ran this with batches of 200 posts without any problems, and it only took about 30 seconds running on Railo. The numbers may vary according to the number of posts you have, as well as the number of comments and categories. Remember that if you have too many comments, your posts will take longer to be migrated, as everything is created in one go.

Step Three:

Run the file  runner.cfm (in my case, and wait till the page stops loading. Once everything is done, you should see a message saying “Done!” on the screen.

Well done, you’ve just migrated from Mango Blog to WordPress without any major hassle.

This script is dealing with a number of custom things I had on my setup, such as different ways of posting code snippets. It should be a problem to people using only one way, or not using it at all, as it tries to replace text only, and won’t break anything should the text isn’t available.

The private method cleanupPostCode, is the method that dos all the conversions, and it’s there that you will need to add any other conversion you may need should you be using other form of syntax highlighting. I’d recommend that id you are not using it, you can simply replace lines 153 and 154 to read:

<cfset var cleanContent = arguments.content>
<cfset var cleanExcerpt = arguments.excerpt>

This way, you are not cleaning up your post’s code, and that should make the code run considerably faster. if you leave it as it was before, it won’t break anything as previously stated.

I hope this script is of any use to someone, and if you feel like modifying / improving the code, please contact me sending the updates, and I’ll merge it and give credit where credit is due. Also, on the right-hand menu, you will find a link to PayPal, where you can make donations to help maintaining this website. Any amount will be much appreciated.

A change is always welcome

Reading time: 6 – 9 minutes

Wordpress GoodiesPhoto by: Huasonic

I’ve been procrastinating for too long, and somehow trying to avoid the inevitable. As must of you might have noticed, it’s been a long time I don’t blog about anything.

It’s mainly because I have been tto busy at work, and am not even having time to read blogs. If I can’t read blogs, you can pretty much guess where all the writing goes.

In fact, another reason why I kind of “lost interest” on blogging, is because I have a huge urge for perfection, and it would “hurt” me any time I wanted to write something, and had to deal with my set-up (trust me, there was a lot involved).

As you know, I’ve been using Mango Blog for nearly two years, and I trully think it’s a great blogging engine within its features, but it lacks on some other aspects. It’s great with all the templates and everything, but I still felt it was missing something, and with my usage, I ended up customizing my template so much, I got pretty tied-up to it.

Changing templates was still viable, but not straight forward as it should be. Also, I got myself writing loads of internal plugins, or hacking away with the core, which although not ideal, would quickly suit my needs and get me “out of trouble”.

Whilst I think it’s an excellent exercise to “hack away”, I’ve always wanted to really have to care about the content, and leave the CMS to do it’s own stuff. Blogging must be about blogging, and I strive to achieve perfection (although I rarely do).

It’s all about time, maybe if I had time, I could update Mango Core and submit my changes to it’s repository. Perhaps I could have made some of my plugins open source. Thing is, most of them were hacks to get me out of trouble as mentioned previously, and would probably cause more damage than benefit on anybody else’s blog.

As an example, I’m probably the only Mango blogger who had a publishing system in place. I was also publishing the homepage, and only using ajax calls to get the number of posts, so the page would be as light as possible. As mentioned earlier, when it comes to my own website, I want YSLOW or Google Page Optimizer go give me A’s or B’s.

Most people who know me, also know that I’m a real CFML advocate, and would try to use it instead of anything else for as long as possible. This time though, I decided it should be about using the right tool for the job.

Come WordPress:

WordPress is an excellent content management system written in PHP, which I’ve been keeping my eyes on for a long time. It makes changing templates and mange plugins as easy as 1-2-3.

I’ve only been playing with WordPress for about a week now, and can easily say it’s gotten my attention at the first minute I saw its admin interface. It’s really intuitive, and managing your content is a doddle.

My main problem with the move, was that I had all my content on a Mango Blog style database, and had to move everything. Although not having really that many blog posts (I’ve always been lazy you see?), I found manually moving 300 odd posts would just be too much, so I decided to write some migration scripts from Mango Blog to WordPress. I’ll post the scripts here at some point, but I’d like to make it clear that I DO NOT intend to maintain them, and they are provided “as is”, so if you come saying “you forgot to var something” or “your code sucks and doesn’t work”, I’ll most likely ignore you, as I simply wrote this script for my own benefit.

It currently migrates posts (including syntax highlighted code), comments and categories from a Mango Blog version 1.4 to a WordPress version 2.9.

To be brutally honest, what really caught my eyes with wordpress, was the facility to add or remove features, as well as re-skinning, plugin installation and mostly important, how good it is to write a blog post using it. I had never used WordPress before, and have to admit I was a bit sceptical about it. As soon as I started using though, the “blogger” feeling came back to me, and I think I finally enjoy blogging again.

It MUST be all about fun, as there is hundreds of other people out there doing the same thing, and you really need to enjoy writing stuff, and letting the world “judge” your thoughts.

It’s all about me:

Well not really, most of the times I write new entries on my blog, I write them thinking about what will attract other people’s interests, and what will be useful. I could go on and on “re-publishing” stuff I found on the web (as I do sometimes), but a blog in my opinion, must focus on creativity, and I expect people to enjoy reading my entries. If you are also a blogger, and keeps saying you write entries only for your own pleasure, and that you don’t expect people to read your blog, you should really be writing a diary, and not publishing it on the web. Every single bit we publish, will build (and sometimes make) history, so lets not fool ourselves.

Why are you saying this, one may ask.

Well, I want readers to feel home here, and want to have as much input as possible to make this a great place to look for information. I already try to post about many different things, so everyone taste some of the knowledge this blog holds. Right above, you will find a contact form, and you… Yeah, YOU! are more than welcome to drop me a line if you’d like me to talk about anything specific.

The comments are also open (once I’m convinced that you’re reliable, and will not be posting spam), so if you feel like your input is valid anywhere in this blog, be my guest to join the discussion.

Hey, I like it, how can I help?

There’s a few ways to contribute, and I’m sure most are aware of the notorious famous

Error: No donation cause selected for this widget. Check widget settings.

Well, this is one way to help. Hosting a website costs cash, and no matter how much I say the fine guys from KickAss VPS are great (they really are), they still keep charging me (well deserved) every month. So any form of cash contributions, is always welcome.

It doesn’t stop there though, you can contribute by suggesting articles or topics you would like me to talk about, submitting articles (or book reviews) you wrote yourself, and I’ll give the respective credit, along with a pat on the shoulder if we ever meet in person.

You can also do something much easier. you can link to me, and tell your friends about this website. It’s easy, and will help with the website’s reputation, therefore making me want to improve it even more.

I hope we can work together in the future.

MangoBlog 1.4 Released and Important notes

Reading time: 3 – 5 minutes

I’m probably late on this one, but mangoBlog v1.4 has just been released. From the changelogs:

What’s new in version 1.4

  • Revisions of posts and pages are now stored and user can “restore” an older version
  • Added a permission for users to not to be able to access the administation (thanks to Seb Duggan)
  • Added a replacement for Verity search to search in database
    directly (this search now includes comments). It is the default search
  • Plugin settings are now stored in database, which should make it easier to migrate a blog
  • TinyMCE editor upgraded
  • Configuration file now has placeholders for base path so that directories do not need to be hardcoded in configuration file
  • Ability to disable or enable threading
  • Plugins made for ColdFusion 8 only can extend org.mangoblog.plugins.BasePlugin without including BasePlugin in their own folder
  • Friendly URLs for author archives

Changes in theme tags:

  • Added a descending order option for the comments tag
  • Enhanced Posts tag to be able to show posts for a given author
  • AuthorProperty tag can now output the name of the role of the author
  • Added AuthenticatedAuthor tag that allows the theme to know if the current visitor is logged in


  • Post pagination and search
  • Session will be maintained while user is writing a post or page
  • Added permission to manage pods and to run blog updates
  • Drafts now always “float” to the top of the list
  • Ability to remove plugins
  • Added “beforeAdminPageContentEnd” event to the bottom of the page
    edit screen and “beforeAdminPostContentEnd” to the bottom of the post
    edit screen
  • Ability to manually set the post URL (thanks to Seb Duggan)
  • Added more functionality to BasePlugin to make it easier to write plugins.
  • Plugins can now run their own upgrade method when a new version is installed via the administration
  • Paging for authors screen
  • Cosmetic changes: Add ons renamed to Plugins, go directly to edit
    mode after adding a new post or page (thanks to Seb Duggan), changed
    Pod Manager icon

Updates to new installs:

  • Added new plugin that allows keeping the old BlogCFC URLs functional
  • Added sample data
  • Include CFFormProtect (enabled by default instead of Captchas)
  • New default theme called Cutline
  • New installs on Railo will now have an error on main page (thanks to Andrea Campolonghi)

Plugins updated:

  • formRememberer (included in update)
  • CFFormProtect (not included in automatic update)

Bug fixes:

  • Solved some compatibility issues with Railo
  • Fixed XSS vulnerability (themes need to be updated to take advantage of this)
  • Preview link was wrong in future posts
  • Comments are now rejected if comments are closed for a post or page
  • Error when entering an empty search string
  • Error when not using friendly URLs
  • and more…


Now, for those who are using Railo and are updating via admin interface. There is a bug with the mango updater and Railo, Laura (Mango blog’s developer) explains:
“This is a known issue with Railo (we should report it, since it is an incompatibility with CF). I thought 1.3.1 included the fix, but apparently not.
Open file components/Updater.cfc and change line 436 from

<cfhttp url="#arguments.zipAddress#" method="get" path="#tempdir#">


<cfhttp url="#arguments.zipAddress#" method="get" path="#tempdir#" file="#filename#">

More info can be found here:
Mango 1.4 upgrade bug / Railo 3.1 / Centos 5

BeerMe v0.2

Reading time: < 1 minute

This is a quick  update for this plugin.
I thought it was a bit boring and didn’t have enough focus. I’ve added some styles to it, and an image, so it looks much nicer now, as you can see at the end of this post
Again, here’s the link for the project download
I hope you enjoy it 😉

My first mango plugin: BeerMe?

Reading time: 2 – 2 minutes

Yes, I went on and got into Mango’s plugin development. Basically on Saturday I was a bit bored monitoring my new server’s performance, and decided to look at plugins development for Mango Blog.
It’s pretty straight forward really, and you only have to create a few files with some pre-defined functions, and off you go.
I always wanted to have a way of nicely asking for donations in my blog. We all know how much this things cost, and sometimes you need to step back, and kindly ask your five readers to make some donations in order to support your infrastructure and the efforts you make to always give a nice experience to them.
Of course I wouldn’t simply place a link to PayPal on the sidebar, so I decided to create this plugin. And that’s why in this post, I’m presenting:


BeerMe is a plugin for Mango Blog that allows you to add a link to PayPal at the bottom of each post. The links are personalized, so you can keep track of which blog post generated more donations.

It’s totally open source, and I still intend to make some changes to it; Also I’ll add a nice image to go with the paypal link (as soon as I have some time to create this image).
An example of the plugin can be seen at the enf of this post, right bellow the bookmark links, and above the tweetbacks. Why not click the link and make your donation? 😉

Click here to download BeerMe
Older posts