Welcome Guest, Not a member yet? Register   Sign In
Converting an app to CI (conceptualizing the breakdown)
#7

[eluser]srajibtechno[/eluser]
ok..thank you...here is my modified code...for menu_model.php and menu_view.php
but it is not working properly...please check this and give me solution as possible..

menu_model.php (model file)

Code:
<?php

/** Model: Left Menu Model
* @author Syed Rajib Rahman , Date : 17-06-2008
* @copyright 2008
*/

class Menu_model extends Model
{
function Menu_model()
{
parent :: Model();

}

function menu_getall()
{
$this->load->database();
$this->db->select('main_menu');
$this->db->from('inbook_links');
$this->db->group_by("main_menu");
$GLOBALS['query'] = $this->db->get();
return $GLOBALS['query']->result();

}


function sub_menu_getall()
{

$this->load->database();

$sub_menu_array = array();

for ($i=0; $i<count($GLOBALS['query']); $i++)
{
for ($i=0; $i<count($GLOBALS['query']); $i++)
{
foreach ($GLOBALS['query'][$i] as $value)
{
array_push($sub_menu_array,$value);

}
}
}

for ($i=0;$i<count($sub_menu_array); $i++)
{
$this->db->select('sub_menu');
$this->db->from('inbook_links');
$this->db->where('main_menu',$sub_menu_array[$i]);

$query2 = $this->db->get();
return $query2->result();
}



//} //End Foreach
//} // End for

} //End sub_menu_getall()

} // End class

?&gt;

menu.php (controller file)

Code:
&lt;?php

/** Controller : Left Menu Controller
* @author Syed Rajib Rahman , Date : 17-06-2008
* @copyright 2008
*/

class Menu extends Controller
{
function Menu()
{
parent :: Controller();
}

function GetAll()
{
$this->load->model('menu_model');
$data=array();
$data['query']=$this->menu_model->menu_getall();
$data['query2']=$this->menu_model->sub_menu_getall();
// $data['query2']=$this->menu_model->menu_getall();
$this->load->view('menu_view',$data);
}

}

?&gt;

menu_view.php (view file)

Code:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1” /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

<div class="mC">

&lt;!-- Main Menu Start --&gt;
&lt;?php
$menuID = 1;

for ($i=0; $i&lt;count($query); $i++)
{
foreach ($query[$i] as $value) { ?&gt;

&lt;div class="mH" onmouseover="toggleMenu(’&lt;?php echo 'menu'.$menuID; ?&gt;’)"&gt;

</div&gt;

<div id="&lt;?php echo 'menu'.$menuID; ?&gt;” class="mL" style="display:none;">
&lt;?php

foreach($query2 as $row2)
{

?&gt;

&lt;?
} ?&gt;

</div>

&lt;?php
}
$menuID++;
}
?&gt;

</div>

&lt;/body&gt;

&lt;/html&gt;


Messages In This Thread
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 10:42 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 01:17 PM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-17-2008, 10:52 PM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-18-2008, 08:08 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 12:51 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 02:18 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 02:31 AM
Converting an app to CI (conceptualizing the breakdown) - by El Forum - 06-19-2008, 09:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB