Create custom glyphicon and add into bootstrap in Yii2 -


new updates asset file dashboardasset created inside asset directory. have several asset files in directory.

   <?php  namespace app\assets;  use yii\web\assetbundle;  /**  * @author qiang xue <qiang.xue@gmail.com>  * @since 2.0  */ class dashboardasset extends assetbundle {     public $basepath = '@webroot';     public $baseurl = '@web';     public $css = [         'css/dashboard.css',         'css/transport.css',     ];     public $js = [      ];     public $depends = [         'yii\web\yiiasset',         'yii\bootstrap\bootstrapasset',     ]; } 

updated folder structure updated folder structure

calling transport icon

enter image description here

final appearance of menu enter image description here

you must define new asset bundle file new fonts. put fonts folder under web called fonts , create style file of including web fonts on file under css folder (please careful address of fonts on css file. it's must address them ../fonts/transport.ttf). structure this:

-| web/  --| fonts/    --| transport.ttf    --| transport.eot    --| transport.svg    --| transport.woff  --| css/    -- transport.css 

now define asset bundle under assets folder based on defining asset bundles - definitive guide yii 2.0 this:

<?php  namespace app\assets;  use yii\web\assetbundle;  class transportasset extends assetbundle {     public $basepath = '@webroot';     public $baseurl = '@web';     public $css = [         'css/transport.css',     ];     public $depends = [         'yii\bootstrap\bootstrapasset',     ]; } 

now on each view file want use transport glyphicon, register asset file:

<?php     \app\assets\transportasset::register($this); ?> <!-- html code --> 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -