Welcome Guest, Not a member yet? Register   Sign In
Need Help for accessing array in view files
#1

[eluser]Mistry007[/eluser]
Hi i am having trouble while accessing array in view file.
Can any one help me out?? I have define one array in view file and i want to access it in my function but it will give me Fatal error: Using $this when not in object context.
Here is my view code.

$menu_array = array();
foreach ($category as $rowdata)
{

$this->menu_array[$rowdata->category_id] = array(
'id' => $rowdata->category_id,
'category' => $rowdata->category_master_name,
'parent_id' => $rowdata->category_parent_id);
}
generate_menu(0);
function generate_menu($parent)
{
print_r($this->menu_array);
}

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB