Handlebars helpers

In an application we are using Handlebars templating. However, we needed many custom helpers to do what we wanted to achieve. Here are some of those helpers. It may help someone who is looking for achieving similar things. Examples are included.


Character limit with trailing characters (optional).

Pun Warning – Warning system for PunBB

Quite long ago, I have developed this extension to warn users due to violating rules in Projanmo Forum. Many asked me for releasing it but I could not release it for various reasons mainly as I could not test in Non-Bangla forums.

Today I decided to release it and so I’ve downloaded punbb and installed and then tested it. Seems it is working fine. So, I am now releasing it.

1. Download and install it as you do other extensions. You will also need to install jQuery extension before installing it. Continue reading →

My experience with phpXperts seminar 2010

phpXperts Seminar 2010, is my third program with phpXperts. Other than phpXperts programs, I have also joined in other programs like Facebook Developer Garage, SQABD Lightning Talks etc. However, this one is exceptional to me as I was one of the speakers in this session.

My initial gratitude goes to Hasin Hayder, who tried hard for first speakers like me. He even advised me about my topic “HTML5 – Web is getting sexy”! Continue reading →

Recaptcha with AJAX application, get new challenge using JavaScript

Currently, I am working on a commercial project (for me) that will be dedicated to the soul of Michael Jackson. I have used some AJAX based interface where I have used reCaptcha challenges to fight spamming. The form where I have used reCaptcha, will be submitted through AJAX calls. As the page won’t reload, the same captcha challenge exists even the user makes a mistake during filling the form.  I wanted to show a new challenge each time he/she makes a mistake. I thought, I will be in trouble in this part! However, I have seen it is extremely easy to get a new challenge. Continue reading →

Facebook Like button for PunBB forum

Facebook likeFacebook like button is a component of its social plugins. It is a great tool of driving traffic to your site. Mashable has a report of increasing referral traffics by 50% by using this Like button.

Considering it as a good tool to drive traffic, I have developed a tiny extension for PunBB bulletin board. When you install this extension, you will find a Like button at the top of Topic View (viewtopic.php). It will also show number of persons liked the topic. Continue reading →

Header Image Rotator for Twenty Ten theme of WordPress 3.0

WordPress 3.0 is still in RC1. I have already upgraded this blog to this version. I can’t but  simply love the new theme ‘Twenty Ten’ which is default in WordPress 3.0. It is super simple theme.

In this theme, there is option to use custom header image. From the admin panel you can select the header image. However, all of the default banners looked interesting to me and I have also uploaded some of my own shots. I wanted to show them all.

Keeping that in mind, I made this simple plugin, Twenty Ten Image Rotator. Having this plugin installed, you can show all images on the header. Single banner each selected randomly on each page load.

I believe if you love Twenty Ten theme, you will love this plugin too :).

Download from WordPress Plugin Repo

WordPress Category Widgets plugin – display different widgets for different categories

Today, I have developed another plugin for WordPress which I named ‘Category Widgets’ plugin and as usual nothing more peaceful rather than sharing with the community.

Using this plugin, you can display a text widget for any specific category and/or its sub-categories. For example, you want to show different sidebar banners based on different category. It is easy using this plugin. Just create a new widget and select the category.

I have found another plugin for almost the same purpose. That plugin lacks of capability of displaying in the subcategories. That mean it does not work for the sub-categories of the selected category. In this plugin, I have made that feature and also optionally you can disable that feature too.


  1. WordPress 2.8+


Continue reading →

Passing filename arguments to PHP from shell and space issue…

Today, while working with a project to import thousands of articles from text files to wordpress,  I had faced a trouble while I am executing a shell script to iterate through all text files and call a PHP script with sending the filename as argument. The PHP script would then process the file as our requirement. The shell script looked like:

for i in `find . -type f -name '*.txt'`;


php import_posts.php $i


Here, $i would be the filename and it is passed to PHP script for processing. But the problem is that, when the filename (including directory name) consists any whitespace in its name, the script would broken. For example, some files path looked like
/home/user/articles/Internet Business/Web Hosting/how_to_start_your_company.txt

Here, notice the space after Internet and Web. The shell script was breaking just after Internet. It was sending /home/user/articles/Internet as argument to PHP script and obviously PHP script was failed to find this file.

After searching a lot, finally I found a solution.

It was really simple. I am quoting from his blog:

If none of your files or folders have spaces in their names, then this isn’t a problem, but that is increasingly unlikely nowadays.  If your songs do have spaces in their filenames, then the solution is to change how the shell splits that output.  This is controlled by the variable $IFS, which is set to spaces, tabs, and newlines by default.  We’d like it set to just newlines, so we do:

So, here is the solution. I just put the following line at the top of my shell script.

export IFS=$'\n'

After that everything is fine. The script is running exactly how I intended it to run.

Thanks for Anthony for his solution.

PunBB Topic Ownership Change extension

Just now I have developed a small extension for PunBB that will let admins and moderators to change the ownership of any topic. As usual, I made it for Projanmo Forum but it is always pleasing to share with the community :).

It is very simple plugin. Just upload and activate the extension. Then if you view any topic with, at least, moderation privilege, you will see a link ‘Change Topic Owner’. When you click on it, you will be asked to enter new User’s ID (check the image below). Once you enter and hit Ok, you will be redirected to a new page where either the ownership will be changed or corresponding error message will be shown.

Note: This will not affect users’ post count.


Technical session on ‘Facebook Application Development’

Yesterday evening, I have participated in a technical session titled “Facebook Application Development” at BASIS SoftExpo 2010. The session was taken by legendary PHP engineer and founder of Leevio, an Social Networking RnD startup, Hasin Hayder.

During the session, the speaker has tried to elaborate the fundamental steps of facebook application development that will show the light to the novices those are interested about facebook application. He also showed ,step by step, a sample facebook application development process.

The whole session was entertaining and useful.

The presentation slide can be downloaded from his blog or directly by clicking here.