Search the Community
Showing results for tags 'controller'.
-
Hello, I am working on admin panel and i have one list page where alll records are displayed i want to send record ID with href to controller like <a href="<?php echo Yii::app()->request->baseUrl.'backend/vehicle/edit/'.$row['vehicle_id'] ?>">Edit</a> but its not working its giving error page not found. when i pass value with "?" query string it works but i want to pass as i mention above please help.
- 1 reply
-
- url
- parameter send
-
(and 1 more)
Tagged with:
-
Hi, I got all the way through the tutorial with no problems until the very end. In “EmployeeController.php” I’m trying to get yii to display the relation for department rather than the ID number. I have tried this code in the loadModel method: $model=Employee::model()->with('department')->findByPk((int)$id); I have double checked all of my relations and they all seem to be in order. It’s still showing the ID number rather than the department name. Any ideas? Thanks
- 8 replies
-
- yii
- controller
-
(and 3 more)
Tagged with:
-
Version 0.5 Loading a Single Model The following two examples work together. The second calls the first. I believe the purpose is to retrieve a record from a table. And I believe each occurrence of $id represents the primary key value of the particular record we want. My question is, how do these functions know which table to search in? page 136: public function loadModel($id) { $model = Page::model()->findByPk($id); if ($model===null) { throw new CHttpException(404, 'The requested page does not exist.'); } Page 139: public function actionView($id){ $this->render('view',array( 'model'=>$this->loadModel($id), )); }
-
Version 0.5 Two questions about page 115. 1. Quoting from the book: "<?php $this->pageTitle = Yii::app()->name . '::' . $model->title; ?>" Why are there two colons before $model->title ? I assume they will appear literally, but maybe they function as code -- I'm not sure. 2. Quoting from the book again: "{TIP} Because the page title is set by assigning a value to the controller instance, it can also be set within the controller action, if you’d rather." This sentence is saying 2 things, neither of which I understand. Larry, can you please break this down and provide an example? Thanks.
-
version 0.5 Page 113 Quoting from the book: "The view files generated by Gii have comments at the top of them that indicate the variables that were passed to the view file. For protected/views/site/index.php, that’s: <?php /* @var $this SiteController */ For protected/views/user/create.php, you’ll see: <?php /* @var $this UserController */ /* @var $model User */ " My question: What actual variables are passed? Is SiteController a variable? Is UserController a variable? What exactly does "$model User" mean? Thanks.