@topic. need explanation how to do
@topic. need explanation how to do
take a look at this thread
i already have this
public function actionList()
{
$criteria=new CDbCriteria;
$limit = 3;
$pages=new CPagination(Event::model()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
// Is the event published or not?
$criteria->condition = "publish = 1";
$models=Event::model()->findAll($criteria);
$banners=$this->loadBanners();
if(isset($_POST['Banners']))
{
$banners->attributes=$_POST['Banners'];
}
$this->render('list',array(
'models'=>$models,
'banners'=>$banners,
'pages'=>$pages
));
}
then an errow shows up
i’m sorry for askin too much. i’m 100% noob.
basically, i just want to know how to put/use a model on a controller of another model?. should i include it? or what?.
is loadYourClassName already defined? if so, then where is it defined? is there an include() statement needed?
i got it. added this:[below] in my default action
public function actionList()
{
require('Banners.php');
$criteria=new CDbCriteria;
$banners = new Banners;
$banner = new CActiveDataProvider($banners);
$limit = 3;
$pages=new CPagination(Event::model()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
// Is the event published or not?
$criteria->condition = "publish = 1";
$models=Event::model()->findAll($criteria);
/* $banners=$this->loadBanners();*/
/*if(isset($_POST['Banners']))
{
$banners->attributes=$_POST['Banners'];
}*/
$this->render('list',array(
'models'=>$models,
'banner'=>$banner,
'pages'=>$pages
));
}
but it seems that i dunno what to do to make the data show. i want this model to be shown on every page that the site has. how exactly do i do that?
Maybe you can create a widget and then call it in the layout/main.php ??
You should create a widget. Take a look here