crisu83 / yiistrap

Twitter Bootstrap for the Yii PHP framework.
http://www.getyiistrap.com
BSD 3-Clause "New" or "Revised" License
286 stars 176 forks source link

hi i have problem TbNavbar #268

Closed andrwsv closed 10 years ago

andrwsv commented 10 years ago

Hi I follow instructions of http://www.getyiistrap.com/site/started, but this report error: Property "CWebApplication.bootstrap" is not defined. what happend, helpme...

thanks

jayala commented 10 years ago

Hello andrwsv, please post more information, like the code is throwing the exception and your config/main.php file.

Regards.

andrwsv commented 10 years ago

Hi, tnaks for you answer jayala,

I create new site with yii and followed instructions of this site. and Downloaded the package and unzip its contents in my extensions/bootstrap folder.

this is my config/main.php :

return array( 'basePath'=>dirname(FILE).DIRECTORY_SEPARATOR.'..', 'name'=>'My Web Application', 'theme'=>'kongoon', 'aliases' => array( 'bootstrap' => realpath(DIR . '/../extensions/bootstrap'), // change this if necessary ), // preloading 'log' component 'preload'=>array('log'),

// autoloading model and component classes
'import'=>array(
    'application.models.*',
    'application.components.*',
            'application.modules.*',
            'bootstrap.*',
            'bootstrap.components.*',
            'bootstrap.behaviours.*',
            'bootstrap.helpers.*',
            'bootstrap.widgets.*',
            'bootstrap.helpers.TbHtml',
),
'modules'=>array(
            'bootstrap'=>array(),
            'gii' => array(
                'class' => 'system.gii.GiiModule',
                'password'=>'1234',
                // If removed, Gii defaults to localhost only. Edit carefully to taste.
                'ipFilters'=>array('127.0.0.1','::1'),
                'generatorPaths' => array(
                    'bootstrap.gii'
                )

in my themes/kongoon/views/main.php I put : Yii::app()->bootstrap->register();

jayala commented 10 years ago

andrwsv, you need to define the bootstrap component:

// application components
'components' => array(
    ...
    'bootstrap' => array(
        'class' => 'bootstrap.components.TbApi',   
    ),
),

Regards.

andrwsv commented 10 years ago

ok, don't report error, but then following this http://www.getyiistrap.com/site/basics and put this code: <?php echo TbHtml::lead('...'); ?> say this error: include(TbArray.php): failed to open stream: No such file or directory

andrwsv commented 10 years ago

ok, I solution, after reinstall all again in my config/main.php put in array import 'bootstrap.', 'bootstrap.components.', 'bootstrap.behaviours.', 'bootstrap.helpers.', 'bootstrap.widgets.*',

then don't say error. but try this http://www.getyiistrap.com/site/widgets

$this->widget('bootstrap.widgets.TbNavbar', array( 'brandLabel' => 'Title', 'display' => null, // default is static to top 'items' => array( array( 'class' => 'bootstrap.widgets.TbNav', 'items' => array( array('label' => 'Home', 'url' => '#', 'active' => true), array('label' => 'Link', 'url' => '#'), array('label' => 'Link', 'url' => '#'), ), ), ), ));

this say errror: include(TbWidget.php): failed to open stream: No such file or directory

andrwsv commented 10 years ago

I have solution, in config/main.php in the array import, insert this line 'ext.bootstrap.behaviors.TbWidget', then work ok

andrwsv commented 10 years ago

thanks jayala for you helpme.