Thursday 12 February 2009
Facebook StumbleUpon Twitter Google+ Pin It

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.


Parthiv Patel
Bhaishri Info Solution
Sr. PHP Developer
Limdi Chowk, AT PO. Nar, Di. Anand
Nar, Gujarat
388150
India
pparthiv2412@gmail.com
7383343029
DOB: 12/24/1986

No comments: