Showing posts with label dropdown tree. Show all posts
Showing posts with label dropdown tree. Show all posts

Thursday, February 12, 2009

Indenting Tree List in Form Input Select using ' ' as spacer

This is the scenario in cakePHP 1.2.

In your controller, you have an action:


function add() {
...
$categories = $this->Listing->Category->generatetreelist(null, null, null, ' ');
$this->set(compact('categories','keywords','metros','states'));
}


where ' ' is your spacer.

Your view will have something like this:


...
echo $form->input('Category');
...


The above combination will display a drop down menu with the '&nsbp;' printed as '&nbsp' and not as a space. So how would you do it in cakePHP 1.2?

The key here is in the view file.

instead of the above statement, you should have this:


...
echo $form->input('Category', array('escape' => false));
...


Hope this one helps.