Reputation: 515
I tried but is not able to solve, checked and is getting the error on Strict Standard
Strict standards: Only variables should be passed by reference in ...
What am i doing wrong - how to correct it
$this->assignRef('prodDet' , $prodDet);
$this->assignRef('CatName' , $modelNewcar->getCatName($id));
$this->assignRef('nav' , $nav);
$this->assignRef('CatList' , $modelNewcar->loadMainCat($brand,$Carmodel,$minprice,$maxprice,$fuel_type));
$this->assignRef('CatName' , $modelNewcar->getCatName);
parent::display($tpl);
In below is the original code
function display($tpl = null)
{
$mainframe =JFactory::getApplication();
$option = JRequest::getCmd('option');
$db =JFactory::getDBO();
$user = JFactory::getUser();
// Push a model into the view
$model = $this->getModel();
$modelNewcar = $this->getModel( 'product' );
$id = JRequest::getVar('id','','default','int');
$vid = JRequest::getVar('vid','','default','int');
$prodDet = $modelNewcar->loadProduct($id,$vid);
$this->assignRef('prodDet' , $prodDet);
$this->assignRef('CatName' , $modelNewcar->getCatName($id));
parent::display($tpl);
}
function display($tpl = null)
{
$db =JFactory::getDBO();
$user = JFactory::getUser();
// Push a model into the view
$model =$this->getModel();
$modelNewcar =$this->getModel( 'category' );
$brand = JRequest::getVar('brand','','default','int');
$Carmodel = JRequest::getVar('model','','default','int');
$minprice = JRequest::getVar('minprice','','default','int');
$maxprice = JRequest::getVar('maxprice','','default','int');
$fuel_type = JRequest::getVar('fuel_type','','default','');
$this->assignRef('nav' , $nav);
$this->assignRef('CatList' , $modelNewcar->loadMainCat($brand,$Carmodel,$minprice,$maxprice,$fuel_type));
$this->assignRef('CatName' , $modelNewcar->getCatName);
parent::display($tpl);
}
Upvotes: 0
Views: 46
Reputation: 2458
It's exactly what the error says. $this->assignRef()
assigns a variable by reference.
For example:
$this->assignRef('CatName' , $modelNewcar->getCatName($id));
Here you try to pass the function getCatName()
to assignRef()
. The solution would be to assign it to a variable first.
$catName = $modelNewcar->getCatName($id);
$this->assignRef('CatName' , $catName);
Docs: http://php.net/manual/en/language.references.pass.php
Upvotes: 2