August 30th, 2010 by Nik Chankov
4 comments »
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.
July 24th, 2010 by Nik Chankov
3 comments »
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?
July 12th, 2010 by Nik Chankov
No comments »
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.
June 27th, 2010 by Nik Chankov
No comments »
I just want to present a new tool for converting HTML to PDF – html-2-pdf.com. 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.
April 24th, 2010 by Nik Chankov
3 comments »
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.
» Read more: Careful with the links in the layout
April 22nd, 2010 by Nik Chankov
1 comment »
Sometimes you need to use url() in the controller.
It’s possible to use Html Helper in this case, but for url() only, you can use:
$link = Router
::url(array('controller'=>'my_controller', 'action'=>'my_acton'), false);
Wll, not a rocket science indeed, but let’s hope this help someone.
March 13th, 2010 by Nik Chankov
No comments »
Today I was working on a page layout where a page width had to be fluid, while the sidebar had to be with fixed width. So here is my solution:
The layout looked like this in the beginning:
» Read more: How to – layout with fixed sidebar
February 28th, 2010 by Nik Chankov
4 comments »
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
» Read more: Problem with mysql_real_escape_string when Sanitize your data.
February 16th, 2010 by Nik Chankov
No comments »

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.
» Read more: Book review – JQuery 1.3 with PHP – Packt Publishing