CakePHP: CakeMenu plugin

I am using it for a while, but today I’ve decided to publish in the

What this plugin does?

The plugin is complete solution to add menu in your applications. It uses the nifty Superfish – jQuery menu plugin. You can find more info for it at

Cakemenu can work with multilevel menus and reduces the database calls by caching the menu nodes. The plugin working with Authake plugin if you need to apply filter to menu nodes (user need to see only allowed locations)

Cakemenu working with CakePHP 1.2 but it’s tested with Cakephp 1.3 (RC3) and it would not have any problems with the future releases so far.


  • CakePHP 1.3 (of course)
  • jQuery in the head tag
  • Authake (optional) if you require your menu nodes to be filtered when user with limited privileges is logged in. Actually it’s possible to use other authorization class, but you have to extend it.

I believe that’s it. Check the large README file in the project’s directory.

CakePHP: Authake plugin with installation guide

Finally the Authake Plugin have an Installation guide.

Basically the plugin provide Authentication and Authorization functionality for CakePHP’s appliation with few line of code. Authake has advanced User-Group-Role interface and allow you to secure your CakePHP’s application within a minute.

The current version of the Plugin is “wrapped” in a single folder (according to CakePHP 1.3 conventions) under the Plugins.

Update: This plugin has been addapted for CakePHP 2.0 by Mutlu Tevfik Kocak. Please use his repository for actual version of the plugin.

isUnique validation of limited length field

Working on a project I had following problem.

I had to set isUnique validation of a field. The field has VARCHAR(10) type. When I save the data the “isUnique” validation doesn’t work as expected while I was sure that the there is such record in the database. Digging through the problem it turn out that the problem is in the length of the DB column.

Let me explain. The field was length 10, but in the form I’ve put the value which is 11 characters long, so when the first data is submitted instead of the 11 characters, only 10 are saved in the DB table. My value was 456-23-2010 while in the db it’s saved 456-23-201.

So when inserting the new data the script checks 456-23-2010 against the database where is stored 456-23-201. and of course it passes the validation. While on the edit action strangely it appear that the value it is not unique any more (because there are already 2 records 456-23-201 in the db. 🙂

A little bit tricky, because at first glance the data is almost the same. For sure if the inserted string was large than the saved in the DB I would spot it easily, but to me the number was really the same.

There are 2 possible ways where I would think how to solve this problem in the future: Either modifying the Bake template for my applications, or using better validation technique – where the value is trimmed up to length of the field.

I was wondering what would be the better way?

New version of Autocompleter plugin

I’ve just updated the wordpress plugin called Autocompleter with a new version.

From now on you can change the type of the results in the autocomplete options. The available options are:

  • Categories and Tags (default)
  • Tags only
  • Categories only
  • Posts and Pages titles
  • Posts titles only
  • Pages titles only

Result types can be changed from the admin page of the plugin.

The change has been made, because there were many requests for such types of results and I finally decided to implement them in the official version of the plugin.

If you use it already, just press upgrade automatically, or visit the official page of the plugin.

Online html to pdf tool

html to pdf converter I just want to present a new tool for converting HTML to PDF – It’s basically an online converter which could transform any* web site to a PDF document. Generally it could be useful if you want to print a website, or for example if you want to save the content of the website for offline reading.

The site is really simple – just insert the address of the web page which you want to be converted and few seconds after that it is ready to be downloaded. The site is just an interface of the amazing wkhtmltopdf library.

I am open for suggestions about the functionality of the site.

* – for some reasons there are web sites which are not converted correctly. This is because of HTTP headers which these sites restricting.

Careful with the links in the layout

When you building application most likely there are common links within the layout. They could be in a menu, or let’s say “edit profile” and ‘logout’ links which are visible everywhere. As you probably know if you use Html Helper the link could be either Cake-relative URL or array of URL parameters.

The problem may occur if you using the second option – the array.
Continue reading

Problem with mysql_real_escape_string when Sanitize your data.

When building applications is always smart to check and clean the user input. This is a must when you building a website or public application.

I create always an instance of Sanitize class in my AppController and then using it in all of my controllers like this
Continue reading

Book review – JQuery 1.3 with PHP – Packt Publishing

jQuery 1.3 with PHP book
At the end of last year I received a request from PacktPub to review one of their books – JQuery 1.3 with PHP written by Kae Verens. There were some problem with delivery of the paper copy of the book, so finally I got an electronic copy.

This book will teach you how to use jQuery to create some really stunning effects,
but without you needing to have in-depth knowledge of how jQuery works. It
provides you with everything you need to build practical user interfaces, for
everything from graphics manipulation and drag-and-drop to data searching, and
much more. The book also provides practical demonstrations of PHP and jQuery and
explains these examples, rather than starting from how JavaScript works and how it
is different from PHP.

The book is separated into 10 Chapters.
Continue reading