[has become SUGGESTION] Load a different model (title changed again ;p ) - Joomla! Forum - community, help and support
hi.
some functions use same model , not have individual one.
so trie load model by: "$model =& $this->getmodel('box')". (file path: component / models / box.php)
immidiatly when function requested view.html.php receive error:
i trie execute function by:
so codes again:
grtz
ps. hope fault, otherwise johan has got more work
some functions use same model , not have individual one.
so trie load model by: "$model =& $this->getmodel('box')". (file path: component / models / box.php)
immidiatly when function requested view.html.php receive error:
fatal error: call member function gettotalmessages() on non-object in c:\program files\wamp\www\components\com_jms\views\inbox\view.html.php on line 69
i trie execute function by:
code: select all
$total = $model->gettotalmessages($where);
so codes again:
code: select all
// @ start
$model =& $this->getmodel('box');
//this requested function in de jmsmodelbox class
/**
* total number of messages
*
* @parram array $where. contains string (without 'where')
* @access public
* @return int
*/
function gettotalmessages($where)
{
$db =& jfactory::getdbo();
$where = implode( "\n , ", $where);
$query = "select count(*) \n #__jms \n $where";
$db->setquery($query);
return $db->loadresult();
}
// triying execute function
$total = $model->gettotalmessages($where);
// results in
fatal error: call member function gettotalmessages() on non-object in c:\program files\wamp\www\components\com_jms\views\inbox\view.html.php on line 69
grtz
ps. hope fault, otherwise johan has got more work
i take creating model in controller?
if assigning view?
then in view should able somehting :
if assigning view?
code: select all
$model =& $this->getmodel('box')
if (!jerror::iserror( $model )) {
$view->setmodel( $model, true );
}
then in view should able somehting :
code: select all
$model = &$this->getmodel();
$total = $model->gettotalmessages($where);
Comments
Post a Comment