buenas noches, estoy creando un modulo en mi app (modules/admin) Todo correcto hasta aca. Estoy practicando con el blog.
Bien el problema que tengo es que no puedo hacer que me muestre el layout "column2" que trae los links para hacer el crud.
Estuve leyendo algnos hilos respecto a esto, pero ninguno me soluciona el problema.
Lo que tengo hasta ahora es lo siguiente:
copie los column1, column2, main.php en modules/admin/views/layouts
En mi admin/componets/Controller.php ya logre hacer la llamada al layout main.php
public function init()
{
$this->layout = 'main';
parent::init();
}
En mi post controller llamo al column2 de esta manera
<?php
class PostController extends Controller
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout='column2';
............
y mis comlumn1 y column2 quite el parametro "//layouts/column2" y "//layouts/column1" respectivamente al metodo <?php $this->beginContent(); ?>
Bien pues no me funciona Cualquier sugerencia o guia es bienvenida, por cierto uso la version 1.1.6 (Jan 16, 2011)
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class Controller extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
*/
public $layout= 'column1';
/**
* @var array context menu items. This property will be assigned to {@link CMenu::items}.
*/
public $menu=array();
/**
* @var array the breadcrumbs of the current page. The value of this property will
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
* for more details on how to specify this property.
*/
public $breadcrumbs=array();
function init(){
$this->layout= 'main';
return parent::init();
}
}
Carga el main, pero no column1 … y mi PostController tampoco carga el column2
<?php
class PostController extends Controller
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
public $layout='column2';
..................
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class Controller extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
*/
/**
* @var array context menu items. This property will be assigned to {@link CMenu::items}.
*/
public $menu=array();
/**
* @var array the breadcrumbs of the current page. The value of this property will
* be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
* for more details on how to specify this property.
*/
public $breadcrumbs=array();
function init(){
$this->layout= 'main';
}
}
Y mi controlador:
PostController:
<?php
class PostController extends Controller
{
/**
* @var string the default layout for the views. Defaults to '//layouts/column2', meaning
* using two-column layout. See 'protected/views/layouts/column2.php'.
*/
function init(){
$this->layout= 'column2';
}
............
Es raro por que segun la documentación y un ejemplo del libro el metodo <?php $this->beginContent(’/layouts/main’); ?> no debe tener ningun parametro, pero si lo dejo vacio, me llama al main principal y no del modulo.