Category tree structure select box in cake php
########################
# Created By : Rahul Dev Xarma
# private function of this class will be use for showing category list in tree structure.
# With selectLeader($id = 0) function
########################
function __display($pid,$level)
{
global $res;
$blank = "";
for($i=0; $i< $level; $i++)
$blank .= "-";
$parents = $this->Category->find('all' , array('conditions' => array('Category.parent_id' => $pid)));
if(!empty($parents))
$level++;
foreach($parents as $value)
{
$res[$value['Category']['id']] = $blank.$value['Category']['name'];
$this->__display($value['Category']['id'],$level);
}
}
########################
# Created By : Rahul Dev Xarma
# This function will be use for showing category list in tree structure
# __display($pid,$level)
########################
function selectLeader($id = 0)
{
global $res;
$level = 0;
$parents = $this->Category->find('all',array('conditions' => array('Category.parent_id' => $id)));
$i = 0;
foreach($parents as $value)
{
$level = 0;
$res[$value['Category']['id']] = $value['Category']['name'];
$this->__display($result['categories_id'],0);
}
return $res;
}
1 Comments:
Hey,
When ever I surf on web I never forget to visit this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Plenty of useful information on phpfriend.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. Let me show you one truth. Research shows that nearly 70% of all United States grownups are either fat or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] So if you're one of these people, you're not alone. Infact many among us need to lose 10 to 20 lbs once in a while to get sexy and perfect six pack abs. Now next question is how you can achive quick weight loss? Quick weight loss can be achived with little effort. Some improvement in of daily activity can help us in losing weight quickly.
About me: I am blogger of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health trainer who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for quick weight loss.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home