Saturday, January 14, 2012

Creating Yii theme from a HTML template

Last week I was working on a  project,that was developed  using YII.Client requested some new features in the existing application and asked us to change the old layout of the application.In this post I am using a HTML template to integrate in YII app.
I have built a default webapp using YII command line tool.If you are not familair with YII command line basic app creation you can check my previous post on YII.
The three simple steps are:
1.Choose a HTML template and keep it under the theme directory an declare it in application configuration.
2.Making valid directory structure so that framework configuration can identify the theme
3.Add PHP code to the static HTML template
Step 1.For this post I have used a Open Source Free HTML5  template,you can choose you own and play with it.
Declare the theme name into the application configuration and it is application/protected/config/main.php and add
1'theme'=>'custom_theme',
Here “custom_theme” is the name of the theme I am using.
Step 2.Keep the HTML template into the themes folder of the application.And create four directory named as follows:
>>js: here we will keep all the javascript files
>>css: here we will keep all the css files
>>images:will keep images related to the theme
>>views:here we will have to create two more directory inside it=> sites and layouts.Here we will keep our files.
Inside layout the main.php file should be kept and this file is inherited by all over the theme.
And inside layout we can keep static and custom layouts like contact us,log in etc.
Step 3.In t his step we will add php code to our html template so that it can work properly and dynamic.
1
2clientScript->registerScriptFile(Yii::app()->theme->baseUrl.'/js/script.js'); ?>
For title you have to add
1<?php echo CHtml::encode($this->pageTitle); ?>
For menu you have to add
1widget('zii.widgets.CMenu',array(
2            'items'=>array(
3                array('label'=>'Home', 'url'=>array('/site/index')),
4                array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
5                array('label'=>'Contact', 'url'=>array('/site/contact')),
6                array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
7                array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
8            ),
9        )); ?>
And the main layout is ready,as other pages are inherited from this main.php the theme is almost ready.
As we are working with YII default command line app,I have to create a form for contact us page.The form is created during the application creation now
we have to put a custom widget to have the contact us form.I have used all the default code from the app just added form inside new custom theme.
The theme is ready.

And Contact us is:

You can fork into my git repo and play with it from here.


N.B:My git YII_THEME app is outside the YII Framework directory,to run it you should keep the framework directory just before it.
To learn more about YII theming,you can check it.

laptops for designers 2012

Top 5 Laptops for Designers

 top best laptop deals

5. Dell Studio XPS 16

http://www.denisdesigns.com/blog/wp-content/uploads/2009/04/laptops_dellxps16.jpg


4. Lenovo ThinkPad W700

laptops_lenovo-thinkpad-w700

 

 

3. MacBook Pro 17”

laptops_mbp17 



2. Dell Precision M6400

laptops_dell-precision-m6400

 

 

1. Sony VAIO AW

laptops_sony-vaio-aw

 There are a few other notable 18+ inchers on the market, but none are as superior as the 18.4” Sony VAIO AW. The advanced 1920×1080 LCD is capable of displaying a whopping 137% of the color gamut, for starters. This Sony laptop is one of the lightest 18.4” laptops around and the specs – Intel Core 2 Duo, 8GB RAM, 512MB GPU, 1TB HDD – are right in line with the rest of the pack. Sony is almost as well known as Apple for style in its VAIO line, so the package is complete. And with that impressive gamut display, there isn’t a better laptop out there for the serious designer.

 top best laptop deals

Toshiba 14-inch ultrabook prototype


Toshiba ultrabook

Asus Transformer Keyboard Dock Review!

Asus Transformer: best laptop deals


Ultra thin and light design in a unique, stylish pattern

With a super slim profile of only 12.98mm thick in a frame that weighs only 680g, the ASUS Eee Pad Transformer is comfortable to hold from any position. The unique textured pattern offers a better tactile sensation, so it won’t feel as if it will slip out of your hands.

Powerful mini-cinema entertainment on-the-go

Powered by the NVIDIA® Tegra™ 2 dual-core processor, the Transformer browses the web at blazing speeds, providing a snappier response time and better performance when multi-tasking. Sporting a HDMI 1.3a port, the Transformer can connect to a HDTV, delivering an enhanced multimedia experience.



An IPS Panel made from durable and scratch-resistant glass is viewable at angles up to 178°, and produces a crisper and more accurate color range by up to 50% when compared to other tablets in the market.


A 5MP rear- and 1.2MP front-facing camera can shoot and record HD video. Output to HD video on HDTVs is also available via a mini HDMI output port, making it a true mobile entertainment device.




Built-in SRS Sound technology provides a dynamic 3D stereo audio experience, with maximum bass response and a wide sound field from the discrete speakers housed within the Transformer. 



Transform to notebook mode with keyboard mobile docking and 16*1 hours of battery life

The Transformer sets itself apart from other tablets on the market by featuring an optional docking station. This provides access to a full QWERTY keyboard along with unique Android Function keys, turning the tablet Transformer into a full-fledged notebook.


A touchpad, 3.5mm audio jack, two USB ports as well as a built-in SD Card reader for easy file sharing and storage expandability makes the Transformer a versatile media hub. The docking station also extends the Transformer’s 9.5 hours*1 of battery life up to 16 hours*1, so users can use it all day for work and play.

Preloaded on the Transformer is Polaris® Office® 3.0, a professional mobile office Solution which enables users to edit various types of office documents including documents (.doc), spreadsheets (.xls) and presentation (.ppt) files, making the Transformer very attractive for professional use. In addition, the ultra-convenient ASUS WebStorage with one year of unlimited storage space provides worry-free cloud computing.




Asus Transformer: best laptop deals

Android 3.2 Honeycomb OS (4.0 Ice Cream Sandwich upgradable)
with ASUS Waveshare UI

Google’s Android 3.2 Honeycomb(4.0 Ice Cream Sandwich upgradable) is a revolutionary operating system specially designed and optimized for tablets, and enables users a full web experience for on-the-go web browsing, communicating and casual computing. Supporting Adobe® Flash® 10.2*2 and the ever growing Android Market, entertainment is a finger swipe away.


The convenient ASUS Launcher also allows users to easily launch software, manage content and access online services and connect devices with a few simple taps.

  


Music, listen to your music or online radio and bring them wherever you go.

  
MyLibrary consolidates downloaded books, magazines and newspapers in to one easy step.

While ASUS' Waveshare Interface hosts a variety of unique applications such as MyNet, MyLibrary, MyCloud and more. MyNet easily streams digital media wirelessly within home network devices so HD videos or music can be played on devices such as an HDTV or desktop PCs for an even better experience from the Transformer.

  


The MyCloud application is a total cloud solution, providing access to digital content such as music, videos and files from the cloud anywhere, anytime. Users can even use MyCloud to remotely access and control any PC or Mac system and access applications or files to extend the versatility of the Eee Pad Transformer experience.

  


ASUS Sync

Asus Transformer: 

 

best laptop deals

To sync your contact list and calendar between Eee Pad and PC.
The Software needs to pair with Eee Pad. (This software is included in the PC Suite Utility.)
Download from ASUS Support Site