Hello,
I’ve got a problem on sending http requests with Yii.
I have this http request: localhost/agri2/index.php?r=post/edit
Which will take me into the Post Controller/actionEdit method.
Which works fine.
But I’m trying to add this in my request : $sender_number=${sender_number}
And I would like for the post/edit to accept this value
Is it possible for the editAction() to be like this editAction($sender_number)?
Or are there any ways possible?
Chabx
Moreover, I’m quietly confuse on how to make the http request:
I’ve tried:
localhost/agri2/index.php?r=post/edit?$sender_number=${sender_number}
localhost/agri2/index.php?r=post/edit $sender_number=${sender_number}
localhost/agri2/index.php?r=post/edit(${sender_number})
So, I’m kind of lost throgh this
abennouna
(Abennouna)
3
Hi,
I’m not sure if I got right what you want.
If what you want is pass a named argument to your action, you can do it like in the standard actionView($id):
public function actionView($id) {
$this->render('view', array(
'model' => $this->loadModel($id, 'SomeModel'),
));
}
And you call that action using Yii helper like this:
echo $this->createUrl('someController/view', array('id' => $someId));
mdomba
(Maurizio Domba Cerin)
4
[color="#008000"]NOTE: moved to proper section (General Discussion for Yii 1.1.x instead of Tips, Snippets and Tutorials)[/color]