Hi
I am new in yii framework. I came across this code.
$criteria=new CDbCriteria();
if(isset($_GET['tag']))
$criteria->addSearchCondition('question.tags',$_GET['tag']);
$param = Yii::app()->request->getParam('param');
$dataProvider=new CActiveDataProvider(Question::model()->recent()->with('user')->with('answers'));
$this->render('index',array('dataProvider'=>$dataProvider,
'param'=>$param,
'tags'=>$tags,
'usertype'=>$usertype));
can anyone explain what getparam('param') and $this->render() do?
and where this 'param' variable coming from?
Thankyou in advance...
Page 1 of 1
Getparam()
#2
Posted 28 January 2013 - 01:25 AM
Quote
getparam('param')
This part of code is about $_GET. it checks and gets the value for param if it is there in the query string.
Quote
$this->render()
this part of code render's i.e. give the output of the code to a view.
#3
Posted 28 January 2013 - 02:10 AM
PeRoChAk, on 28 January 2013 - 01:25 AM, said:
This part of code is about $_GET. it checks and gets the value for param if it is there in the query string.
Thanks...
but where can i find 'param' variable. Actually this code is in actionask() in fcontroller.php.
And i have a model question.php which have attributes qid,question(text),instituteid(int).
i have to view the question in index.php.
so where the condition is specified like (where(instituteid ==5))?
#4
Posted 28 January 2013 - 02:44 AM
share the code so that I can tell you about it.
moreover, here param is just for demonstration.
we can have it as
then we can get value of a in site/question action as
moreover, here param is just for demonstration.
we can have it as
CHtml::link('[age url',$this->createUrl('site/question',array('a'=>1)));
then we can get value of a in site/question action as
Yii::app()->request->getParam('a');
Share this topic:
Page 1 of 1

Help













