[eluser]seminalJim[/eluser]
Im having trouble loading libraries in codeigniter (2.1.2), with HMVC installed...
Ive tried setting the autoload (/config/autoload.php) and can use the db class in (controllers/articles.php)...
Code:
$this->db->get('articles');
.. works fine!
However, I cant use the db class from a module controller, eg.
modules/MOD_Content/controllers/Content.php/fetch($id)
Code:
$this->load->model('MOD_Content/content_model');
$object = $this->content_model->getRowOf('articles', $id);
modules/MOD_Content/models/Content_model.php/getRowOf($db_name, $id)
Code:
class Content_Model extends CI_Model
{
function getRowOf($db_name, $id)
{
$this->db->where('id', $id);
$query = $this->db->get($db_name);
return $query->row();
}
}
I get this message...
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Snapsemenu::$db
Filename: core/Model.php
Line Number: 51
I traced the snapsemenu bit to my controller (controllers/articles.php)
Code:
class Articles extends MX_Controller
{
public function article($id)
{
$css = array();
$script = array();
echo html_open_new(@$page_title, $css, $script);
echo container_open();
// echo Modules::run('MOD_Header/Header/render');
echo Modules::run('MOD_SnapseMenu/SnapseMenu/render');
$modules = array
(
// 1 => array
// (
// 'path' => 'MOD_Sidemenu/sidemenu/render',
// 'config' => array
// (
// 'widgets' => array
// (
// 'search'=>'WID_Sidemenu/search/render',
// 'topten'=>'WID_Sidemenu/topten/render',
// ),
// )
// ),
2 => array
(
'path' => 'MOD_Content/content/render',
'config' => array
(
'layout' => 'single',
'content_type' => 'article',
'ref_id' => $id
)
)
);
echo Modules::run('MOD_Flatland/flatland/render', $modules);
echo container_close();
echo html_close();
}
}
If i comment-out the line
Code:
echo Modules::run('MOD_SnapseMenu/SnapseMenu/render');
It seems to work for some reason? I am totally mystified?
Please somebody help?