Yii Framework Forum: Getparam() - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Getparam() Rate Topic: -----

#1 User is offline   nkhanna 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 27-January 13

Posted 28 January 2013 - 12:38 AM

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...
0

#2 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 579
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

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.
Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

#3 User is offline   nkhanna 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 27-January 13

Posted 28 January 2013 - 02:10 AM

View PostPeRoChAk, 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))?
0

#4 User is offline   PeRoChAk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 579
  • Joined: 26-November 10
  • Location:Lahore, Pakistan

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

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');

Cheers
Perochak
Web Design - Logo Design - Application Development

My Blog | Forums Comparison
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users