Theming and layout in yii framework

前端 未结 2 877
南笙
南笙 2021-02-06 06:46

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

2条回答
  •  青春惊慌失措
    2021-02-06 06:50

    Try this step by step :

    1. 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

    2. 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

      Then you will have a file Application_Root/css/mystyle.css

    3. Create the content placeholder.

      Somewhere in your main.php, there will be a placeholder for dynamic text, which is specified by.

    4. 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'

    5. 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.

    6. 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';

    7. Refresh the page

提交回复
热议问题