[eluser]Unknown[/eluser]
I'm refitting an existing website to work with codeigniter. The current system stores the navigation config in a single table cell using XML in this format:
Code:
<NAVIGATION>
<item1>
<id>1</id>
<name>Home</name>
<link></link>
<parent>0</parent>
<target>_self</target>
<rel>follow</rel>
<menu>main</menu>
</item1>
<item2>
<id>2</id>
<name>Some Page</name>
<link>some-page</link>
<parent>0</parent>
<target></target>
<rel>follow</rel>
<menu>main</menu>
</item2>
</NAVIGATION>
I'm not sure what the original developer had in mind, but for reasons which will remain unexplained I would like to maintain this format for now.
I created a navigation model which pulls this XML from the db and converts it into an array.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Navigation_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
function get_navigation()
{
$this->db->select('pages.block');
$this->db->from('pages');
$this->db->join('style','style.styleID = pages.styleID','left');
$this->db->where('style.name','data');
$this->db->where('pages.locID',$this->config->item('splitID'));
$this->db->like('pages.block','<NAVIGATION>');
$navigation_query = $this->db->get();
$navigation_row = $navigation_query->row_array();
return xml2array($navigation_row['block']);
}
}
/* End of file navigation_model.php */
/* Location: ./application/model/navigation_model.php */
What I'm trying to do, is to load this model in a config file called navigation.php and load the navigation array into the global $config array. I tried both autoloading the model and loading inside navigation.php but to no avail.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$this->load->model('Navigation_model');
var_dump($this->Navigation_model->get_navigation());
/* End of file navigation.php */
/* Location: ./application/config/navigation.php */
I keep getting the following error:
Quote:Severity: Notice
Message: Undefined property: CI_Config::$load
Filename: config/navigation.php
Line Number: 3
How can I best accomplish what I am trying to do?