Reputation:
How paths working on Yii? For example code below is places in
/webapp/views/project/view.php:
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$issueDataProvider,
'itemView'=>'/issue/_view',
)); ?>
my structure:
/webapp
/component
/controller.php
/controllers
/ProjectControllers
/views
/project/view
/issue/_view
My question is how
'itemView'=>'/issue/_view'
works?
Upvotes: 1
Views: 1289
Reputation: 7340
You can find description here.
... the corresponding view file based on the following criteria:
- absolute view within a module: the view name starts with a single slash '/'. In this case, the view will be searched for under the currently active module's view path. If there is no active module, the view will be searched for under the application's view path.
- absolute view within the application: the view name starts with double slashes '//'. In this case, the view will be searched for under the application's view path. This syntax has been available since version 1.1.3.
- aliased view: the view name contains dots and refers to a path alias. The view file is determined by calling YiiBase::getPathOfAlias(). Note that aliased views cannot be themed because they can refer to a view file located at arbitrary places.
- relative view: otherwise. Relative views will be searched for under the currently active controller's view path.
Upvotes: 1