Commits

Bogdan Savluk committed 0728685

twig extension, modify site templates to use twig

  • Participants
  • Parent commits 79331ed
  • Branches twig

Comments (0)

Files changed (26)

 testapp/protected/extensions/swiftMailer=https://bitbucket.org/z_bodya/yii-swiftmailer
 testapp/protected/extensions/multiselect=https://bitbucket.org/z_bodya/yii-multiselect
 testapp/protected/extensions/datetimepicker=https://bitbucket.org/z_bodya/yii-datetimepicker
+testapp/protected/extensions/twig=ssh://hg@bitbucket.org/z_bodya/yii-twig
 
-ac3ad7cfbd5100c05cc5761b946098d6f1f8d33f testapp/protected/extensions/chosen
+32f6261081e6b6e874e9e7d280a06b11683d7fcb testapp/protected/extensions/chosen
 10f95710bd0c9fabee232b0b5dd6d0b9fa0c1928 testapp/protected/extensions/coordinatepicker
 9de050cb21a3dd1e4be5399dfd3f2cc2d7a6df01 testapp/protected/extensions/datetimepicker
-02a356417545212772a8f73651d4052f8648f591 testapp/protected/extensions/elFinder
+f0142cc5cb14eb3dac7386fef8687347a340b6ad testapp/protected/extensions/elFinder
 9b139a80de80fe528f69d02e57ef6af02a6e88f9 testapp/protected/extensions/fileimagearbehavior
 46dbff057db9e290ac46992c9bf4d3ccbec7ff29 testapp/protected/extensions/galleryManager
 2c669abd97f92c898b10672b8ebf0f2f7e73ff27 testapp/protected/extensions/image
 2ac3fda0ab7e2754826e5969cff43ec5ddf4229b testapp/protected/extensions/multiselect
 29a901c09ec8ec796efe967b2eb127790a78e3ea testapp/protected/extensions/swiftMailer
 4a204c302973fade3c2afdf56aec9729c5b655d5 testapp/protected/extensions/tinymce
+324d2275dec652f398a96ed7e87695f828da5bb5 testapp/protected/extensions/twig

File testapp/protected/components/Controller.php

      * @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 = '//layouts/column1';
+    public $layout = false;
     /**
      * @var array context menu items. This property will be assigned to {@link CMenu::items}.
      */

File testapp/protected/controllers/SiteController.php

             // captcha action renders the CAPTCHA image displayed on the contact page
             'captcha' => array(
                 'class' => 'CCaptchaAction',
+                'backend'=>'gd',
                 'backColor' => 0xFFFFFF,
             ),
             // page action renders "static" pages stored under 'protected/views/site/pages'
      */
     public function actionError()
     {
+        $this->pageTitle = 'Error';
+        $this->breadcrumbs = array('Error',);
         if ($error = Yii::app()->errorHandler->error) {
             if (Yii::app()->request->isAjaxRequest)
                 echo $error['message'];
                 $this->refresh();
             }
         }
+        $this->pageTitle = 'Contact Us';
+        $this->breadcrumbs = array(
+            'Contact',
+        );
         $this->render('contact', array('model' => $model));
     }
 
             if ($model->validate() && $model->login())
                 $this->redirect(Yii::app()->user->returnUrl);
         }
-        // display the login form
+
+        $this->pageTitle = 'Login';
+        $this->breadcrumbs = array(
+            'Login',
+        );
         $this->render('login', array('model' => $model));
     }
 

File testapp/protected/modules/admin/views/test/gallery.php

-<div class="container-fluid">
-    <div class="row-fluid">
-        <div class="span<?php echo(isset($_GET['w']) ? $_GET['w'] : '12')?>">
-            <?php
-            $this->widget('GalleryManager', array(
-                'gallery' => $gallery,
-            ));
-            ?>
-
-        </div>
-    </div>
-</div>

File testapp/protected/modules/admin/views/test/gallery.twig

+<div class="container-fluid">
+    <div class="row-fluid">
+        <div class="span12">
+            {% do this.widget('GalleryManager', { 'gallery':gallery})  %}
+        </div>
+    </div>
+</div>

File testapp/protected/modules/admin/views/test/static_editor.php

-<div class="container-fluid">
-    <div class="row-fluid">
-        <div class="span12">
-            <?php echo $content;?>
-        </div>
-    </div>
-</div>

File testapp/protected/modules/admin/views/test/static_editor.twig

+<div class="container-fluid">
+    <div class="row-fluid">
+        <div class="span12">
+            {{ content|raw }}
+        </div>
+    </div>
+</div>

File testapp/protected/modules/admin/views/test/widgets.php

-<div class="container-fluid">
-    <div class="row-fluid">
-        <div class="span12">
-            <?php
-            /**
-             * @var BHorizontalForm $form
-             * @var TestModel $model
-             */
-            ?>
-
-            <?php $form = $this->beginWidget('BHorizontalForm',
-            array(
-                'enableAjaxValidation' => false,
-            )); ?>
-
-            <?php
-
-
-            echo $form->textFieldControlGroup($model, 'lat', array('autocomplete' => 'off'));
-
-            echo $form->beginControlGroup($model, 'long');
-            echo $form->textField($model, 'long');
-            echo '<br/>';
-
-            $this->widget('ext.coordinatepicker.CoordinatePicker', array(
-                'model' => $model,
-                'latitudeAttribute' => 'lat',
-                'longitudeAttribute' => 'long',
-                //optional settings
-                'editZoom' => 12,
-                'pickZoom' => 7,
-                'defaultLatitude' => 50.443513052458044,
-                'defaultLongitude' => 30.498046875,
-            ));
-            echo $form->endControlGroup();
-
-            echo $form->textFieldControlGroup($model, 'text', array('autocomplete' => 'off'));
-            echo $form->passwordControlGroup($model, 'password', array('autocomplete' => 'off'));
-            echo $form->checkBoxControlGroup($model, 'checkBox');
-            echo $form->textAreaControlGroup($model, 'textArea');
-            ?>
-
-            <?php
-            echo $form->dropDownListControlGroup($model, 'dropDown', $model->listData());
-
-            echo $form->beginControlGroup($model, 'dropDown1');
-            echo Chosen::activeDropDownList($model, 'dropDown1', $model->listData());
-            echo $form->endControlGroup();
-
-            echo $form->listBoxControlGroup($model, 'listBox', $model->listData(), array('multiple' => true));
-
-
-            echo $form->beginControlGroup($model, 'listBox1');
-            echo Chosen::activeMultiSelect($model, 'listBox1', $model->listData());
-            echo $form->endControlGroup();
-
-            echo $form->checkBoxListControlGroup($model, 'checkBoxList', $model->listData());
-            echo $form->fileFieldControlGroup($model, 'file');
-            echo $form->radioButtonListControlGroup($model, 'radioButtonList', $model->listData());
-            echo $form->beginControlGroup($model, 'tinyMceArea');
-            $this->widget('ext.tinymce.TinyMce', array(
-                'model' => $model,
-                'attribute' => 'tinyMceArea',
-                'htmlOptions' => array(
-                    'rows' => 6,
-                    'cols' => 60,
-                ),
-            ));
-            echo $form->endControlGroup($model);
-
-            echo $form->beginControlGroup($model, 'serverFile');
-            $this->widget('ext.elFinder.ServerFileInput', array(
-                    'model' => $model,
-                    'attribute' => 'serverFile',
-                )
-            );
-            echo $form->endControlGroup($model);
-
-            echo $form->beginControlGroup($model, 'date');
-
-                $this->widget('ext.datetimepicker.DateTimePicker', array(
-                    'model' => $model,
-                    'attribute' => 'date',
-                    'language' => 'ru',
-                    'options' => array(
-                        'dateFormat' => 'dd.mm.yy',
-                        'timeFormat' => 'hh:mm:ss',
-                    ),
-                ));
-
-            echo $form->endControlGroup($model);
-
-            echo '<div class="control-group">' .
-                CHtml::label('FileManager', 'none', array('class' => 'control-label')) .
-                '<div class="controls">';
-            $this->widget('ext.elFinder.ElFinderWidget', array());
-            echo '</div></div>';
-            ?>
-            <?php
-            /**
-             * @var BTabs $tabs
-             */
-            $tabs = $this->beginWidget('BTabs');
-            ?>
-            <?php $tabs->beginTab('Home', 'home')?>
-            <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua,
-                retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica.
-                Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure
-                terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan
-                american apparel, butcher voluptate nisi qui.</p>
-            <?php $tabs->endTab()?>
-            <?php $tabs->beginTab('Profile')?>
-            <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid.
-                Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four
-                loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk
-                aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore
-                aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente
-                labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard
-                ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher
-                vero sint qui sapiente accusamus tattooed echo park.</p>
-            <?php $tabs->endTab()?>
-            <?php $tabs->beginDropDown('DropDown')?>
-            <?php $tabs->beginTab('First')?>
-            <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo
-                retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft
-                beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR
-                banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever
-                gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you
-                probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu
-                synth chambray yr.</p>
-            <?php $tabs->endTab()?>
-            <?php $tabs->beginTab('Second')?>
-
-            <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out
-                master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan
-                DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia
-                PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf
-                viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan,
-                sartorial keffiyeh echo park vegan.</p>
-            <?php $tabs->endTab();?>
-            <?php $tabs->endDropDown();?>
-            <?php $this->endWidget(); ?>
-            <hr/>
-            <a class="btn" data-toggle="modal" href="#myModal">Launch Modal</a>
-
-            <div class="modal fade" id="myModal">
-                <div class="modal-header">
-                    <a class="close" data-dismiss="modal">×</a>
-
-                    <h3>Modal header</h3>
-                </div>
-                <div class="modal-body">
-                    <p>One fine body…</p>
-                </div>
-                <div class="modal-footer">
-                    <a href="#" class="btn btn-primary">Save changes</a>
-                    <a href="#" class="btn" data-dismiss="modal">Close</a>
-                </div>
-            </div>
-
-            <div class="form-actions">
-                <button type="submit" class="btn btn-large btn-primary">
-                    Submit
-                </button>
-            </div>
-
-            <?php $this->endWidget(); ?>
-
-        </div>
-    </div>
-</div>

File testapp/protected/modules/admin/views/test/widgets.twig

+<div class="container-fluid">
+    <div class="row-fluid">
+        <div class="span12">
+            {% set form = this.beginWidget('BHorizontalForm',{'enableAjaxValidation': false,}) %}
+
+            {{ form.textFieldControlGroup(model, 'lat', {'autocomplete':'off'})|raw }}
+            {{ form.beginControlGroup(model, 'long')|raw }}
+            {{ form.textField(model, 'long')|raw }}
+            <br/>
+
+            {% do this.widget('ext.coordinatepicker.CoordinatePicker', {
+            'model': model,
+            'latitudeAttribute' : 'lat',
+            'longitudeAttribute' : 'long',
+            'editZoom' : 12,
+            'pickZoom' : 7,
+            'defaultLatitude' :50.443513052458044,
+            'defaultLongitude': 30.498046875,
+            }) %}
+            {{ form.endControlGroup()|raw }}
+
+            {{ form.textFieldControlGroup(model, 'text', {'autocomplete': 'off'})        |raw }}
+            {{ form.passwordControlGroup(model, 'password', {'autocomplete': 'off'})     |raw }}
+            {{ form.checkBoxControlGroup(model, 'checkBox')                              |raw }}
+            {{ form.textAreaControlGroup(model, 'textArea')                              |raw }}
+
+            {{ form.dropDownListControlGroup(model, 'dropDown', model.listData())|raw }}
+
+            {{ form.beginControlGroup(model, 'dropDown1')|raw }}
+            {% do this.widget('Chosen', {'name' : html.activeName(model,'dropDown1'),
+            'value': html.value(model,'dropDown1'),
+            'data':model.listData,
+            'htmlOptions': {},
+            'multiple' : false,})|raw %}
+
+            {{ form.endControlGroup()|raw }}
+
+            {{ form.listBoxControlGroup(model, 'listBox', model.listData(), {'multiple' : true})|raw }}
+            {{ form.beginControlGroup(model, 'listBox1')|raw }}
+
+            {% do this.widget('Chosen', {'name' : html.activeName(model,'listBox1'),
+            'value': html.value(model,'listBox1'),
+            'data':model.listData,
+            'htmlOptions': {},
+            'multiple' : true,})|raw %}
+
+            {{ form.endControlGroup()|raw }}
+
+            {{ form.checkBoxListControlGroup(model, 'checkBoxList', model.listData())|raw }}
+            {{ form.fileFieldControlGroup(model, 'file')|raw }}
+            {{ form.radioButtonListControlGroup(model, 'radioButtonList', model.listData())|raw }}
+            {{ form.beginControlGroup(model, 'tinyMceArea')|raw }}
+            {% do this.widget('ext.tinymce.TinyMce', {
+            'model' : model,
+            'attribute' : 'tinyMceArea',
+            'htmlOptions' : {
+            'rows' : 6,
+            'cols' : 60,
+            },
+            }) %}
+
+            {{ form.endControlGroup()|raw }}
+
+            {{ form.beginControlGroup(model, 'serverFile')|raw }}
+            {% do this.widget('ext.elFinder.ServerFileInput', {
+            'model' : model,
+            'attribute' : 'serverFile',
+            }) %}
+
+            {{ form.endControlGroup(model)|raw }}
+            {{ form.beginControlGroup(model, 'date')|raw }}
+
+            {% do this.widget('ext.datetimepicker.DateTimePicker', {
+            'model' : model,
+            'attribute' : 'date',
+            'language' : 'ru',
+            'options' : {
+            'dateFormat' : 'dd.mm.yy',
+            'timeFormat' : 'hh:mm:ss',
+            },}) %}
+
+            {{ form.endControlGroup(model)|raw }}
+
+            <div class="control-group">' .
+                {{ html.label('FileManager', 'none', {'class' : 'control-label'}) }}
+                <div class="controls">
+                    {% do this.widget('ext.elFinder.ElFinderWidget', {}) %}
+                </div>
+            </div>
+            {% set tabs = this.beginWidget('BTabs') %}
+            {% do tabs.beginTab('Home', 'home') %}
+            <p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua,
+                retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica.
+                Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure
+                terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan
+                american apparel, butcher voluptate nisi qui.</p>
+            {% do tabs.endTab() %}
+            {% do tabs.beginTab('Profile') %}
+            <p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid.
+                Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four
+                loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk
+                aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore
+                aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente
+                labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard
+                ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher
+                vero sint qui sapiente accusamus tattooed echo park.</p>
+            {% do tabs.endTab() %}
+            {% do tabs.beginDropDown('DropDown') %}
+            {% do tabs.beginTab('First') %}
+            <p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo
+                retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft
+                beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR
+                banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever
+                gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you
+                probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu
+                synth chambray yr.</p>
+            {% do tabs.endTab() %}
+            {% do tabs.beginTab('Second') %}
+
+            <p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out
+                master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan
+                DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia
+                PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf
+                viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan,
+                sartorial keffiyeh echo park vegan.</p>
+            {% do tabs.endTab() %}
+            {% do tabs.endDropDown() %}
+            {% do this.endWidget() %}
+            <hr/>
+            <a class="btn" data-toggle="modal" href="#myModal">Launch Modal</a>
+
+            <div class="modal fade" id="myModal">
+                <div class="modal-header">
+                    <a class="close" data-dismiss="modal">×</a>
+
+                    <h3>Modal header</h3>
+                </div>
+                <div class="modal-body">
+                    <p>One fine body…</p>
+                </div>
+                <div class="modal-footer">
+                    <a href="#" class="btn btn-primary">Save changes</a>
+                    <a href="#" class="btn" data-dismiss="modal">Close</a>
+                </div>
+            </div>
+
+            <div class="form-actions">
+                <button type="submit" class="btn btn-large btn-primary">
+                    Submit
+                </button>
+            </div>
+
+            {% do this.endWidget() %}
+
+        </div>
+    </div>
+</div>

File testapp/protected/siteTemplates/column1.twig

+{% extends "@siteTemplates/main.twig" %}
+{% block content %}
+    <div id="content">
+        {% block internalContent %}{% endblock %}
+    </div><!-- content -->
+{% endblock %}

File testapp/protected/siteTemplates/column2.twig

+{% extends "@siteTemplates/main.twig" %}
+{% block content %}
+    <div class="span-19">
+        <div id="content">
+            {% block internalContent %}{% endblock %}
+        </div>
+        <!-- content -->
+    </div>
+    <div class="span-5 last">
+        <div id="sidebar">
+            {% autoescape false %}
+            {% do this.beginWidget('zii.widgets.CPortlet', {'title': 'Operations'}) %}
+            {% do this.widget('zii.widgets.CMenu', {
+            'items' :this.menu,
+            'htmlOptions' :{'class' : 'operations'},
+            }) %}
+            {% endautoescape %}
+        </div>
+        <!-- sidebar -->
+    </div>
+{% endblock %}

File testapp/protected/siteTemplates/main.twig

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="language" content="en"/>
+
+    <!-- blueprint CSS framework -->
+    <link rel="stylesheet" type="text/css" href="{{ app.request.baseUrl }}/css/screen.css"
+          media="screen, projection"/>
+    <link rel="stylesheet" type="text/css" href="{{ app.request.baseUrl }}/css/print.css"
+          media="print"/>
+    <!--[if lt IE 8]>
+    <link rel="stylesheet" type="text/css" href="{{ app.request.baseUrl }}/css/ie.css"
+          media="screen, projection"/>
+    <![endif]-->
+
+    <link rel="stylesheet" type="text/css" href="{{ app.request.baseUrl }}/css/main.css"/>
+    <link rel="stylesheet" type="text/css" href="{{ app.request.baseUrl }}/css/form.css"/>
+
+    <title>{{ this.pageTitle }}</title>
+</head>
+
+<body>
+
+<div class="container" id="page">
+
+    <div id="header">
+        <div id="logo">{{ app.name }}</div>
+    </div>
+    <!-- header -->
+
+    <div id="mainmenu">
+        {% do this.widget('zii.widgets.CMenu', {
+        'items' : [
+        {'label':'Home', 'url' : ['/site/index']},
+        {'label':'About', 'url' : {0:'/site/page', 'view': 'about'}, },
+        {'label':'Contact', 'url' : ['/site/contact']},
+        {'label':'Login', 'url' : ['/site/login'], 'visible' : app.user.isGuest},
+        {'label':'Logout (' + app.user.name + ')', 'url': ['/site/logout'], 'visible' :not(app.user.isGuest), }
+        ],
+        }) %}
+    </div>
+    <!-- mainmenu -->
+    {% if(not this.breadcrumbs is empty) %}
+        {% do this.widget('zii.widgets.CBreadcrumbs', { 'links': this.breadcrumbs}) %}
+    {% endif %}
+
+    {% block content %}
+    {% endblock %}
+
+    <div class="clear"></div>
+
+    <div id="footer">
+        Copyright &copy; 2012 by My Company.<br/>
+        All Rights Reserved.<br/>
+    </div>
+    <!-- footer -->
+</div>
+<!-- page -->
+</body>
+</html>

File testapp/protected/views/layouts/column1.php

-<?php $this->beginContent('//layouts/main'); ?>
-<div id="content">
-    <?php echo $content; ?>
-</div><!-- content -->
-<?php $this->endContent(); ?>

File testapp/protected/views/layouts/column2.php

-<?php $this->beginContent('//layouts/main'); ?>
-<div class="span-19">
-    <div id="content">
-        <?php echo $content; ?>
-    </div>
-    <!-- content -->
-</div>
-<div class="span-5 last">
-    <div id="sidebar">
-        <?php
-        $this->beginWidget('zii.widgets.CPortlet', array(
-            'title' => 'Operations',
-        ));
-        $this->widget('zii.widgets.CMenu', array(
-            'items' => $this->menu,
-            'htmlOptions' => array('class' => 'operations'),
-        ));
-        $this->endWidget();
-        ?>
-    </div>
-    <!-- sidebar -->
-</div>
-<?php $this->endContent(); ?>

File testapp/protected/views/layouts/main.php

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-    <meta name="language" content="en"/>
-
-    <!-- blueprint CSS framework -->
-    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css"
-          media="screen, projection"/>
-    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css"
-          media="print"/>
-    <!--[if lt IE 8]>
-    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css"
-          media="screen, projection"/>
-    <![endif]-->
-
-    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css"/>
-    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css"/>
-
-    <title><?php echo CHtml::encode($this->pageTitle); ?></title>
-</head>
-
-<body>
-
-<div class="container" id="page">
-
-    <div id="header">
-        <div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
-    </div>
-    <!-- header -->
-
-    <div id="mainmenu">
-        <?php $this->widget('zii.widgets.CMenu', array(
-        'items' => array(
-            array('label' => 'Home', 'url' => array('/site/index')),
-            array('label' => 'About', 'url' => array('/site/page', 'view' => 'about')),
-            array('label' => 'Contact', 'url' => array('/site/contact')),
-            array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),
-            array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)
-        ),
-    )); ?>
-    </div>
-    <!-- mainmenu -->
-    <?php if (isset($this->breadcrumbs)): ?>
-        <?php $this->widget('zii.widgets.CBreadcrumbs', array(
-        'links' => $this->breadcrumbs,
-    )); ?><!-- breadcrumbs -->
-    <?php endif?>
-
-    <?php echo $content; ?>
-
-    <div class="clear"></div>
-
-    <div id="footer">
-        Copyright &copy; <?php echo date('Y'); ?> by My Company.<br/>
-        All Rights Reserved.<br/>
-        <?php echo Yii::powered(); ?>
-    </div>
-    <!-- footer -->
-
-</div>
-<!-- page -->
-
-</body>
-</html>

File testapp/protected/views/site/contact.php

-<?php
-$this->pageTitle = Yii::app()->name . ' - Contact Us';
-$this->breadcrumbs = array(
-    'Contact',
-);
-?>
-
-<h1>Contact Us</h1>
-
-<?php if (Yii::app()->user->hasFlash('contact')): ?>
-
-<div class="flash-success">
-    <?php echo Yii::app()->user->getFlash('contact'); ?>
-</div>
-
-<?php else: ?>
-
-<p>
-    If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
-</p>
-
-<div class="form">
-
-    <?php $form = $this->beginWidget('CActiveForm', array(
-    'id' => 'contact-form',
-    'enableClientValidation' => true,
-    'clientOptions' => array(
-        'validateOnSubmit' => true,
-    ),
-)); ?>
-
-    <p class="note">Fields with <span class="required">*</span> are required.</p>
-
-    <?php echo $form->errorSummary($model); ?>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'name'); ?>
-        <?php echo $form->textField($model, 'name'); ?>
-        <?php echo $form->error($model, 'name'); ?>
-    </div>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'email'); ?>
-        <?php echo $form->textField($model, 'email'); ?>
-        <?php echo $form->error($model, 'email'); ?>
-    </div>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'subject'); ?>
-        <?php echo $form->textField($model, 'subject', array('size' => 60, 'maxlength' => 128)); ?>
-        <?php echo $form->error($model, 'subject'); ?>
-    </div>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'body'); ?>
-        <?php echo $form->textArea($model, 'body', array('rows' => 6, 'cols' => 50)); ?>
-        <?php echo $form->error($model, 'body'); ?>
-    </div>
-
-    <?php if (CCaptcha::checkRequirements()): ?>
-    <div class="row">
-        <?php echo $form->labelEx($model, 'verifyCode'); ?>
-        <div>
-            <?php $this->widget('CCaptcha'); ?>
-            <?php echo $form->textField($model, 'verifyCode'); ?>
-        </div>
-        <div class="hint">Please enter the letters as they are shown in the image above.
-            <br/>Letters are not case-sensitive.
-        </div>
-        <?php echo $form->error($model, 'verifyCode'); ?>
-    </div>
-    <?php endif; ?>
-
-    <div class="row buttons">
-        <?php echo CHtml::submitButton('Submit'); ?>
-    </div>
-
-    <?php $this->endWidget(); ?>
-
-</div><!-- form -->
-
-<?php endif; ?>

File testapp/protected/views/site/contact.twig

+{% extends "@siteTemplates/column1.twig" %}
+{% block internalContent %}
+    <h1>Contact Us</h1>
+
+    {% if(app.user.hasFlash('contact')) %}
+        <div class="flash-success">
+            {{ app.user.getFlash('contact') }}
+        </div>
+    {% else %}
+
+        <p>
+            If you have business inquiries or other questions, please fill out the following form to contact us. Thank
+            you.
+        </p>
+
+        <div class="form">
+            {% set form = this.beginWidget('CActiveForm', {
+            'id' : 'contact-form',
+            'enableClientValidation' : true,
+            'clientOptions' :{
+            'validateOnSubmit': true,
+            },
+            })|raw %}
+
+            <p class="note">Fields with <span class="required">*</span> are required.</p>
+
+            {{ form.errorSummary(model)|raw }}
+
+            <div class="row">
+                {{ form.labelEx(model, 'name')|raw }}
+                {{ form.textField(model, 'name')|raw }}
+                {{ form.error(model, 'name')|raw }}
+            </div>
+
+            <div class="row">
+                {{ form.labelEx(model, 'email')|raw }}
+                {{ form.textField(model, 'email')|raw }}
+                {{ form.error(model, 'email')|raw }}
+            </div>
+
+            <div class="row">
+                {{ form.labelEx(model, 'subject')|raw }}
+                {{ form.textField(model, 'subject', {'size': 60, 'maxlength': 128})|raw }}
+                {{ form.error(model, 'subject')|raw }}
+            </div>
+
+            <div class="row">
+                {{ form.labelEx(model, 'body')|raw }}
+                {{ form.textArea(model, 'body', {'rows':6, 'cols':50})|raw }}
+                {{ form.error(model, 'body')|raw }}
+            </div>
+
+
+            <div class="row">
+                {{ form.labelEx(model, 'verifyCode')|raw }}
+                <div>
+                    {% do this.widget('CCaptcha')|raw %}
+                    {{ form.textField(model, 'verifyCode')|raw }}
+                </div>
+                <div class="hint">Please enter the letters as they are shown in the image above.
+                    <br/>Letters are not case-sensitive.
+                </div>
+                {{ form.error(model, 'verifyCode')|raw }}
+            </div>
+
+
+            <div class="row buttons">
+                <button type="submit">Post</button>
+            </div>
+
+            {% do this.endWidget()|raw %}
+        </div>
+        <!-- form -->
+
+    {% endif %}
+
+{% endblock %}

File testapp/protected/views/site/error.php

-<?php
-$this->pageTitle = Yii::app()->name . ' - Error';
-$this->breadcrumbs = array(
-    'Error',
-);
-?>
-
-<h2>Error <?php echo $code; ?></h2>
-
-<div class="error">
-    <?php echo CHtml::encode($message); ?>
-</div>

File testapp/protected/views/site/error.twig

+{% extends "@siteTemplates/column1.twig" %}
+{% block internalContent %}
+
+    <h2>Error {{ code }}</h2>
+
+    <div class="error">
+        {{ message }}
+    </div>
+
+{% endblock %}

File testapp/protected/views/site/index.php

-<?php $this->pageTitle = Yii::app()->name; ?>
-
-<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>
-
-<p>Congratulations! You have successfully created your Yii application.</p>
-
-<p>You may change the content of this page by modifying the following two files:</p>
-<ul>
-    <li>View file: <tt><?php echo __FILE__; ?></tt></li>
-    <li>Layout file: <tt><?php echo $this->getLayoutFile('main'); ?></tt></li>
-</ul>
-
-<p>For more details on how to further develop this application, please read
-    the <a href="http://www.yiiframework.com/doc/">documentation</a>.
-    Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>,
-    should you have any questions.</p>
-
-<?php
-$images = array();
-foreach ($gallery = Gallery::model()->findByPk(2)->galleryPhotos as $photo) {
-    /** @var $photo GalleryPhoto */
-    $images[] = array(
-        'small' => $photo->getUrl('small'),
-        'large' => $photo->getUrl('medium'),
-        'big' => $photo->getUrl(''),
-    );
-}
-
-?>

File testapp/protected/views/site/index.twig

+{% extends "@siteTemplates/column1.twig" %}
+{% block internalContent %}
+
+    <h1>Welcome to <i>{{ app.name }}</i></h1>
+
+    <p>Congratulations! You have successfully created your Yii application.</p>
+
+    <p>For more details on how to further develop this application, please read
+        the <a href="http://www.yiiframework.com/doc/">documentation</a>.
+        Feel free to ask in the <a href="http://www.yiiframework.com/forum/">forum</a>,
+        should you have any questions.</p>
+
+{% endblock %}

File testapp/protected/views/site/login.php

-<?php
-$this->pageTitle = Yii::app()->name . ' - Login';
-$this->breadcrumbs = array(
-    'Login',
-);
-?>
-
-<h1>Login</h1>
-
-<p>Please fill out the following form with your login credentials:</p>
-
-<div class="form">
-    <?php $form = $this->beginWidget('CActiveForm', array(
-    'id' => 'login-form',
-    'enableClientValidation' => true,
-    'clientOptions' => array(
-        'validateOnSubmit' => true,
-    ),
-)); ?>
-
-    <p class="note">Fields with <span class="required">*</span> are required.</p>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'username'); ?>
-        <?php echo $form->textField($model, 'username'); ?>
-        <?php echo $form->error($model, 'username'); ?>
-    </div>
-
-    <div class="row">
-        <?php echo $form->labelEx($model, 'password'); ?>
-        <?php echo $form->passwordField($model, 'password'); ?>
-        <?php echo $form->error($model, 'password'); ?>
-        <p class="hint">
-            Hint: You may login with <tt>demo/demo</tt> or <tt>admin/admin</tt>.
-        </p>
-    </div>
-
-    <div class="row rememberMe">
-        <?php echo $form->checkBox($model, 'rememberMe'); ?>
-        <?php echo $form->label($model, 'rememberMe'); ?>
-        <?php echo $form->error($model, 'rememberMe'); ?>
-    </div>
-
-    <div class="row buttons">
-        <?php echo CHtml::submitButton('Login'); ?>
-    </div>
-
-    <?php $this->endWidget(); ?>
-</div><!-- form -->

File testapp/protected/views/site/login.twig

+{% extends "@siteTemplates/column1.twig" %}
+{% block internalContent %}
+
+    <h1>Login</h1>
+
+    <p>Please fill out the following form with your login credentials:</p>
+
+    <div class="form">
+
+        {% set form = this.beginWidget('CActiveForm', {
+        'id': 'login-form',
+        'enableClientValidation' : true,
+        'clientOptions' :{
+        'validateOnSubmit':true,
+        },})|raw %}
+
+
+        <p class="note">Fields with <span class="required">*</span> are required.</p>
+
+        <div class="row">
+            {{ form.labelEx(model, 'username')|raw }}
+            {{ form.textField(model, 'username')|raw }}
+            {{ form.error(model, 'username')|raw }}
+        </div>
+
+        <div class="row">
+            {{ form.labelEx(model, 'password')|raw }}
+            {{ form.passwordField(model, 'password')|raw }}
+            {{ form.error(model, 'password')|raw }}
+            <p class="hint">
+                Hint: You may login with <tt>demo/demo</tt> or <tt>admin/admin</tt>.
+            </p>
+        </div>
+
+        <div class="row rememberMe">
+            {{ form.checkBox(model, 'rememberMe')|raw }}
+            {{ form.label(model, 'rememberMe')|raw }}
+            {{ form.error(model, 'rememberMe')|raw }}
+        </div>
+
+        <div class="row buttons">
+            <button type="submit">Login</button>
+        </div>
+
+        {% do this.endWidget()|raw %}
+        {#{% endautoescape %}#}
+    </div><!-- form -->
+
+{% endblock %}

File testapp/protected/views/site/pages/about.php

-<?php
-$this->pageTitle = Yii::app()->name . ' - About';
-$this->breadcrumbs = array(
-    'About',
-);
-?>
-<h1>About</h1>
-
-<p>This is a "static" page. You may change the content of this page
-    by updating the file <tt><?php echo __FILE__; ?></tt>.</p>

File testapp/protected/views/site/pages/about.twig

+{% extends "@siteTemplates/column1.twig" %}
+{% block internalContent %}
+
+    <h1>About</h1>
+
+    <p>This is a "static" page. You may change the content of this page
+        by updating view file</p>
+
+{% endblock %}