I am a newbie in Yii Framework and creating a CRM which is module based. Using different tutorials I am able to create my own theme, but now I am stucked at one point.
I
Try this step by step :
Create New theme
You can create a new theme and add this to the directory Application_Root/themes.
Look at the themes/classic directory to get an an idea of the structure of the directory. The important file (at this stage) is :- Application_Root/themes/views/layouts/main.php
Customise your theme contents
Copy the css, image, js files etc to the correct directory and change the main.php file to your liking. For example, if your main.php says
<link href="css/mystyle.css" rel="stylesheet">
Then you will have a file Application_Root/css/mystyle.css
Create the content placeholder.
Somewhere in your main.php, there will be a placeholder for dynamic text, which is specified by.
<?php echo $content; ?>
Tell yii to use the theme. Change the file Application_Root/protected/config/main.php by adding the following line just before the last line (containing the closing bracket).
'theme'=>'surveyhub'
Create the layout placeholders.
Create an HTML segment that will be written into the $contents portion of main.php. Call it for example one_column.php. The file path will therefore be Application_Root/themes/views/layouts/one_column.php In that file, where you want the dynamic text to be placed, create a placeholder.
<?php echo $content; ?>
Tell Yii to use the layout.
In the file Application_Root/protected/components/Controller.php, add or modify the layout variable to read :
public $layout='//layouts/one_column.php';
Refresh the page
Using a custom layout for your view is the right way to go. You can either set the layout in the controller action or in the view.
$this->layout = "//layouts/mylayout";
Note that the default layouts column1.php and column2.php also use the main.php layout file.