Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1935 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

CodeIgniter Framework help

Thread title: CodeIgniter Framework help
Reply    
    Thread tools Search this thread Display Modes  
12-29-2012, 07:33 AM
#1
unikorndesigns is offline unikorndesigns
unikorndesigns's Avatar
Status: Junior Member
Join date: May 2011
Location:
Expertise: Web Designing and Development
Software: Photoshop, Dreamweaver and etc
 
Posts: 41
iTrader: 0 / 0%
 

unikorndesigns is on a distinguished road

  Old  CodeIgniter Framework help

Please analyze the following code. This is being used in CodeIgniter framework...

$results["rows"]=$this->Category_model->getAll();
$i=0;
while($i<count($results["rows"]))
{
//$parentids[]=$results["rows"][$i]->cat_id;
$disparray[]=array(
"cat_id" => $results["rows"][$i]->cat_id,
"cat_name" => $this->Category_model->fetchcatinfo($results["rows"][$i]->cat_id, "cat_name"),
"cat_parent_id" => $this->Category_model->fetchcatinfo($results["rows"][$i]->cat_id, "cat_parent_id"),
"cat_desc" => $this->Category_model->fetchcatinfo($results["rows"][$i]->cat_id, "cat_desc"),
"cat_num_posts" => $this->Category_model->fetchnumposts($results["rows"][$i]->cat_id),
"cat_parent_id_name"=>$this->Category_model->fetchcatinfo($this->Category_model->fetchcatinfo($results["rows"][$i]->cat_id, "cat_parent_id"), "cat_name")
);
$array=explode(",",$this->Category_model->fetchallkids($results["rows"][$i]->cat_id,0));
foreach($array as $item)
{
if(strlen($item)>0)
{
$spacecount=substr_count($item,"&nbsp;");
$id=str_replace("&nbsp;","",$item);
$spaces=array();
while($spacecount>=0)
{
$spaces[]="&nbsp;";
$spacecount--;
}
$disparray[]=array(
"cat_id" => $id,
"cat_name" => implode($spaces).$this->Category_model->fetchcatinfo($id, "cat_name"),
"cat_parent_id" => $this->Category_model->fetchcatinfo($id, "cat_parent_id"),
"cat_desc" => $this->Category_model->fetchcatinfo($id, "cat_desc"),
"cat_num_posts" => $this->Category_model->fetchnumposts($id),
"cat_parent_id_name"=>$this->Category_model->fetchcatinfo($this->Category_model->fetchcatinfo($id, "cat_parent_id"), "cat_name")
);
}
}
$i++;
}
// echo "Parent ID : ".$parentids[0]["cat_id"]."<br><br>";
// echo "The array being passed to the view part: <br>";
foreach($disparray as $item)
{
$finalarray["row"]=implode("|",$item);
}
$this->load->view("category", $finalarray);

In the view section when i try to output the array like print_r($row). It shows only the last element. When i try to display the contents of the $disparray in the controller part, its working fine.

I would like to know if instead of making and transferring $finalarray if i just transfer the $disparray how will i be able to display the contents of the array in the view part? Thanks in advance

Reply With Quote
12-29-2012, 09:27 AM
#2
unikorndesigns is offline unikorndesigns
unikorndesigns's Avatar
Status: Junior Member
Join date: May 2011
Location:
Expertise: Web Designing and Development
Software: Photoshop, Dreamweaver and etc
 
Posts: 41
iTrader: 0 / 0%
 

unikorndesigns is on a distinguished road

  Old

no offense viewers!! i got it solved myself!! thanks for your peeps on the post!! :P

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed