Monday, February 1, 2016

yii getBaseUrl and getHomeUrl

Yii::app()->getBaseUrl(true);   // => http://localhost/yii_projectsYii::app()->getHomeUrl();       // => /yii_projects/index.php
Yii::app()->getBaseUrl(false);  // => /yii_projects

Image Thumbnails Using PHP

function make_thumb($src, $dest, $desired_width) {

 /* read the source image */
 $source_image = imagecreatefromjpeg($src);
 $width = imagesx($source_image);
 $height = imagesy($source_image);
 /* find the "desired height" of this thumbnail, relative to the desired width  */
 $desired_height = floor($height * ($desired_width / $width));
 /* create a new, "virtual" image */
 $virtual_image = imagecreatetruecolor($desired_width, $desired_height);
 /* copy source image at a resized size */
 imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
 /* create the physical thumbnail image to its destination */
 imagejpeg($virtual_image, $dest);

Monday, January 11, 2016

Yuor Barin Can Raed Tihs

S1M1L4RLY, Y0UR M1ND 15 R34D1NG 7H15 4U70M471C4LLY W17H0U7 3V3N 7H1NK1NG 4B0U7 17

Friday, December 4, 2015

YouTube video generated images -- for thumbnails   


Sunday, November 22, 2015

magento block types

For understanding more about magento block types following are some built-in block types which are widely used in layout.
  1. core/template: This block renders a template defined by its template attribute. The majority of blocks defined in the layout are of type or subtype of core/template.
  2. page/html: This is a subtype of core/template and defines the root block. All other blocks are child blocks of this block.
  3. page/html_head: Defines the HTML head section of the page which contains elements for including JavaScript, CSS etc.
  4. page/html_header: Defines the header part of the page which contains the site logo, top links, etc.
  5. page/template_links: This block is used to create a list of links. Links visible in the footer and header area use this block type.
  6. core/text_list: Some blocks like contentleftright etc. are of type core/text_list. When these blocks are rendered, all their child blocks are rendered automatically without the need to call thegetChildHtml() method.
  7. page/html_wrapper: This block is used to create a wrapper block which renders its child blocks inside an HTML tag set by the action setHtmlTagName. The default tag is 
     if no element is set.
  8. page/html_breadcrumbs: This block defines breadcrumbs on the page.
  9. page/html_footer: Defines footer area of page which contains footer links, copyright message etc.
  10. core/messages: This block renders error/success/notice messages.
  11. page/switch: This block can be used for the language or store switcher.
This is a list of only commonly used block types. There are many other block types which are used in advanced theme implementations.

Tuesday, June 23, 2015

Yii 1.1 path

Yii::app()->getBaseUrl(true);   // => http://localhost/sample
Yii::app()->getHomeUrl();       // => /sample/index.php
Yii::app()->getBaseUrl(false);  // => /sample

Yii::app()->request->baseUrl // => /sample

Yii::app()->theme->baseUrl //=> sample/themes/bluetheme

Thursday, May 21, 2015

Composer Yii 2.0 update

set the path to php.exe

A:\>cd xampp
A:\xampp>cd php

check the php version; should be greater than 5.4

A:\xampp\php>php -v
PHP 5.6.3 (cli) (built: Nov 12 2014 17:18:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

i copied the composer files from C:\Users\jerome\AppData\Local\ComposerSetup\bin
composer, composer.bat, composer.phar
i think only phar file is needed, anyways copied all the files into xampp/php folder

 Volume in drive A is Data
 Volume Serial Number is C629-A5C0

 Directory of A:\xampp\php

05/17/2015  03:22 PM              .
05/17/2015  03:22 PM              ..
06/18/2013  02:04 PM              cfg
05/16/2015  10:18 PM               587 composer
10/16/2013  06:21 PM                38 composer.bat
05/16/2015  10:18 PM         1,103,875 composer.phar

follow the instructions from
--install the composer asset plugin

A:\xampp\php>php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
Changed current directory to C:/Users/jlabs/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

install the project files

A:\xampp\php>php composer.phar create-project yiisoft/yii2-app-advanced ../htdocs/advanced 2.0.4
Installing yiisoft/yii2-app-advanced (2.0.4)
  - Installing yiisoft/yii2-app-advanced (2.0.4)
    Loading from cache

Created project in ../htdocs/advanced
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing yiisoft/yii2-composer (2.0.3)
    Loading from cache

  - Installing ezyang/htmlpurifier (v4.6.0)
    Loading from cache

  - Installing cebe/markdown (1.1.0)
    Loading from cache

  - Installing bower-asset/jquery (2.1.4)
    Loading from cache

  - Installing bower-asset/jquery.inputmask (3.1.63)
    Loading from cache

  - Installing bower-asset/punycode (v1.3.2)
    Loading from cache

  - Installing bower-asset/yii2-pjax (v2.0.4)
    Loading from cache

  - Installing yiisoft/yii2 (2.0.4)
    Loading from cache

  - Installing swiftmailer/swiftmailer (v5.4.0)
    Loading from cache

  - Installing yiisoft/yii2-swiftmailer (2.0.4)
    Loading from cache

  - Installing yiisoft/yii2-codeception (2.0.4)
    Loading from cache

  - Installing bower-asset/bootstrap (v3.3.4)
    Loading from cache

  - Installing yiisoft/yii2-bootstrap (2.0.4)
    Loading from cache

  - Installing yiisoft/yii2-debug (2.0.4)
    Loading from cache

  - Installing bower-asset/typeahead.js (v0.10.5)
    Loading from cache

  - Installing phpspec/php-diff (v1.0.2)
    Loading from cache

  - Installing yiisoft/yii2-gii (2.0.4)
    Loading from cache

  - Installing fzaninotto/faker (v1.4.0)
    Loading from cache

  - Installing yiisoft/yii2-faker (2.0.3)
    Loading from cache

Writing lock file
Generating autoload files


Blogger templates