#1 2011-07-20 13:42:04

khalidshah
Member
Registered: 2011-07-20
Posts: 1

AssetLibPro integration

hi all
i have integrated the AssetLibPro library which is use for css and js compression  in ionize
the process are here:

1- download the AssetLibPro and its related files from http://code.google.com/p/assetlib-pro/downloads/list
and see http://code.google.com/p/assetlib-pro/w … figuration      for installation
2- put the A library file "Assetlibpro.php" in application library folder
3 - put  A config file "assetlibpro.php" in application config folder
4- change the config options in line 17,18,19
$config['alp_asset_dir'] = '/assets/';//TRAILING SLASH!
$config['alp_cache_dir_css'] = '/assets/compressed/';//TRAILING SLASH!
$config['alp_cache_dir_js'] = '/assets/compressed/';//TRAILING SLASH!

into
$config['alp_asset_dir'] = '';//TRAILING SLASH!
$config['alp_cache_dir_css'] = '/tmp/';//TRAILING SLASH!
$config['alp_cache_dir_js'] = '/tmp/';//TRAILING SLASH!

and create tmp folder at root for storing combine css / js file

5- add the config file name in autoload.php  i.e  $autoload['config'] = array('ionize','assetlibpro');

6- add library in  autoload.php  i.e  $autoload['libraries'] = array('settings','assetlibpro')

7- Download CSSTidy and put the contents of the package into your "/system/plugins/" folder (https://sourceforge.net/project/showfil … _id=166584)

8- Download JSMin and put the jsmin php file (renamed to "jsmin.php"!) into your "/system/plugins/" folder
(http://jsmin-php.googlecode.com/files/jsmin-1.1.1.php)
9- now create tags in application\libraries\Tagmanager.php  so tags you have to add two functions in TagManager class  as  below :

/**
    *this use combine css into one compress file
    * for add css file use tag in view i.e (<ion:csscompress  add="assets/css/screen.css" media="all" module=''/>)
    * csscompress tag have atrrbuties add (path of css file) ,media(css media type i.e print ,screen), module(use css in module)
     */
public function tag_csscompress($tag)
  {
    $CI =& get_instance();
   
    if(isset($tag->attr['add']) && !empty($tag->attr['add']))
    {
        if(!isset($tag->attr['module']))  $tag->attr['module']=null;
        if(!isset($tag->attr['media'])) $tag->attr['media']='screen';
       
    $CI->assetlibpro->add_css(Theme::get_theme_path().$tag->attr['add'],$tag->attr['media'],$tag->attr['module']);
   
    }
    else return $CI->assetlibpro->output('css');
  }

/**
    *this use combine js into one compress file
    * for add js file use tag in view i.e (<ion:csscompress  add="assets/css/screen.css" group=" " module=''/>)
    * csscompress tag have atrrbuties add (path of css file) ,group(), module(use css in module)
     */
public function tag_jscompress($tag)
  {
    $CI =& get_instance();
   
    if(isset($tag->attr['add']) && !empty($tag->attr['add']))
    {
        if(!isset($tag->attr['module'])) $tag->attr['module']=null;
        if(!isset($tag->attr['group'])) $tag->attr['group']='default';
       
    $CI->assetlibpro->add_css(Theme::get_theme_path().$tag->attr['add'],$tag->attr['group'],$tag->attr['module']);
   
    }
    else return $CI->assetlibpro->output('js');
  }

after adding these functions add the tags name in array in line number 49
protected $tag_definitions = array
    (
        'debug' =>                'tag_debug',
        'field' =>                'tag_field',
        'config' =>             'tag_config',
        'base_url' =>            'tag_base_url',
        'partial' =>             'tag_partial',
        'widget' =>                'tag_widget',
        'translation' =>         'tag_translation',
        'name' =>                 'tag_name',
        'site_title' =>         'tag_site_title',
        'meta_keywords' =>         'tag_meta_keywords',
        'meta_description' =>     'tag_meta_description',
        'setting' =>             'tag_setting',
        'time' =>                'tag_time',
        'if' =>                    'tag_if',
        'else' =>                'tag_else',
        'set' =>                'tag_set',
        'get' =>                'tag_get',
        'php' =>                'tag_php',
        'jslang' =>                'tag_jslang',
        'csscompress'=>         'tag_csscompress',
        'jscompress'=>            'tag_jscompress'
    );

add these tags
'csscompress'=>         'tag_csscompress',
        'jscompress'=>            'tag_jscompress'

as show above in array

10- now you can use the  tags csscompress and jscompress in page head  for css / js compression
for example
these tags use for adding css which combine
<ion:csscompress  add="assets/css/screen.css"  />
<ion:csscompress  add="assets/css/style.css" />

this tag show output combine file in header this tag call one time in page
<ion:csscompress />

enjoy this thanx to all

Last edited by khalidshah (2011-07-20 13:51:41)

Offline

#2 2011-07-21 08:16:19

azzus
Member
Registered: 2010-04-26
Posts: 44

Re: AssetLibPro integration

hi,

What for this librarry ?
Have you tested ? what version ionizer can used this library ?

Thanks for advance

Offline

#3 2011-07-21 17:30:29

ukyo
Community Manager
From: Marmaris - Turkey
Registered: 2010-05-19
Posts: 734
Website

Re: AssetLibPro integration

Check "BBCODES" : http://www.ionizecms.com/forum/help.php#bbcode

for clear post view! Use code areas! your post will be clear and understandable!


<ion:ukyo from="Turkey" />
Ionize CMS Türkçe Dil Çeviri Dosyaları | My Github Repositories
Please send your first message to a forum section, not forum users or administration.

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations