[EXTENSION] Bootstrap

Hello guys!

Someone know if its possible to change the location of the .css files in the html code ? I’m testing seo+bootstrap and i noticed that the css used by bootstrap are always loaded in first place on the html code and after the seo extension.




<!doctype html>

<html>

<link rel="stylesheet" type="text/css" href="/yii-bootstrap/assets/9b5b5612/css/bootstrap.css" />

<link rel="stylesheet" type="text/css" href="/yii-bootstrap/assets/9b5b5612/css/bootstrap-yii.css" />

<link rel="stylesheet" type="text/css" href="/yii-bootstrap/assets/563dbbc7/highlight.css" />

<link rel="stylesheet" type="text/css" href="/yii-bootstrap/css/styles.css" />

<script type="text/javascript" src="/yii-bootstrap/assets/2c3c7d1a/jquery.js"></script>

<script type="text/javascript" src="/yii-bootstrap/assets/9b5b5612/js/bootstrap.js"></script>

<title>...</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="Content-Language" content="en-US" />

<meta name="description" content="..." />

...



What i want to know is if its possible to put the meta’s first?

The CSS are being placed on top of TAG "title", try putting the TAG "title" below the meta tags.

You’re right Lothor, thanks for the tip!

Btw, I’m using the extension SEO done by Chris, if someone has the same problem, can be solved by changing line 82 in file SeoHead.php, placing it at the end of renderContent() method.

I do not know the extent of SEO, but if not available, you can try to parameterize it.

Hi,

U have two questions :

I have a problem with Gii generator. It doesn’t generate new form code based on Bootstrap.

Is there a theme for this extension ?

Ok is it me, or does the ACTIVE class don’t get appended to the dropdown menu parent in a navbar?

I have 2 dropdowns in my navbar, and none has active class when it’s children are active.

Solution anyone?

Here is my navbar code.

Hi.

How can I add date input


<input type="date" name="checkin-date">

with bootstrap?

Thanks.

Thanks for the detailed explanation!

Hello,

I’m create Navbar menu bar (hardcode menu item) as below:


$this->widget('bootstrap.widgets.TbNavbar', array(

  'id'=>'tbNavbar1',

  ..    		

  'items'=>array(

      array(

        'class'=>'bootstrap.widgets.TbMenu',

           'items'=>array(

            	array('label'=>'Menu1', 'url'=>'#', 'items'=>array(

            		array('label'=>'submenu1', 'url'=>'#'),

            		array('label'=>'submenu2', 'url'=>'#'), 

            	)),



Now I would like to build the dynamic sub-menu item from database but it doesn’t work (return empty submenu items)


array('label'=>'Menu1', 'url'=>'#', 

     'items'=>Yii::app()->session['submenu'],

),



Thanks for help

No matter where your submenu comes from (session, controller) you have to make sure it’s a valid multidimensional array hence an array with sub-arrays that contain label, url, etc. Here’s an example with a manually and quickly added array (don’t have time to do more sorry):


<?php

$submenu = array();

$submenu[] = array('label'=>'submenu1', 'url'=>'#');

$submenu[] = array('label'=>'submenu2', 'url'=>'#');


$this->widget('bootstrap.widgets.BootNavbar', array(

    'type'=>'inverse',

    'items'=>array(

        array(

            'class'=>'bootstrap.widgets.BootMenu',

            'items'=>array(

                array('label'=>'Menu1', 'url'=>'#', 'items'=>$submenu),

            ),

        ),

    ),

)); ?>

Hope it helps. Not sure if adding this array (submenu) to the php session is the right way to do this.

However, check out this link for more info about adding arrays to php session.

Hi Don Felipe,

I’m build the multidimensional array with structure as your guide. It works well.

Thank you very much.

Regards,

Greetings… I am converting the views for yii-user and yii-rights to leverage this module… it’s starting to look really nice. (happy to contribute back for anyone that would want it).

I am having a little trouble with converting one item that when rendered with the CMenu widget, works, but I can not seem to get it to work with TbButton.

Here is the original code from the yii-user module view:




$this->menu=array(

    array('label'=>UserModule::t('Delete User'), 'url'=>'#','linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>UserModule::t('Are you sure to delete this item?')))

);



Here is how I currently have it in my theme/view:




$this->widget('bootstrap.widgets.TbButton', array(

		'buttonType'=>'link',

		'icon'=>'trash',

		'type'=>'danger',

		'label'=>UserModule::t('Delete User'), 

		'url'=>array('delete','id'=>$model->id),

		'htmlOptions'=>array('confirm'=>UserModule::t('Are you sure to delete this item?')),

		'size'=>'Large'

		));



It does the prompt,but then goes to the URL (which requires a POST not a GET). Any advice?

I also tried it as a submit link, but got this error (and have this error when converting rights to use the TbGridView as well… thoughts? "Uncaught TypeError: Cannot call method ‘submitForm’ of undefined "

Many Thanks. And Chris -> Love this module and yii-rights… thank you for your constant contributions.

Hi Folks,

I’m getting this error with the latest version of the bootstrap extension when using the TbMenu widget


Property "TbMenu.itemCssClass" is not defined

Everything worked fine before I upgraded to the latest version of the extension and if I comment out the two relevant lines in TbBaseMenu everything seems to work as expected (so far, anyway).


if ($this->itemCssClass !== null)

   $classes[] = $this->itemCssClass;

Also, I don’t get the error on my local machine, only on a live server. Does anyone have any ideas what’s going on?

how to make collapse sub menu on nav list?

[b]

[/b]

Hi,

I am using your extension and it was wonderful. have u doubt on that.

I want load a form with checkBoxListRow with some checkboxes preselected. How to achieve? please let me know

<?php echo $form->checkBoxListRow($model, ‘checkboxes’, array(

    'Option one is this and that—be sure to include why it&#092;'s great',


    'Option two can also be checked and included in form results',


    'Option three can—yes, you guessed it—also be checked and included in form results',


), array('hint'=&gt;'&lt;strong&gt;Note:&lt;/strong&gt; Labels surround all the options for much larger click areas.')); ?&gt;

hello guys,i am new to yii, i am trying to use bootstrap but iam receive this error Alias "bootstrap.widgets.TbNavbar" is invalid. Make sure it points to an existing PHP file. whenever i try to use one of the widgets,i believe its a setting problem but i cant find where i am doing things wrong,here is my config/main.php


<?php


// uncomment the following to define a path alias

// Yii::setPathOfAlias('local','path/to/local-folder');


// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

        'language'=>'en_us',

        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

        'name'=>'CODEPAC',


        // preloading 'bootstrap,log' component

        'preload'=>array('bootstrap','log',),


        // autoloading model and component classes

        'import'=>array(

                'application.models.*',

                'application.components.*',


        ),


        'modules'=>array(

                // uncomment the following to enable the Gii tool

                'user'=>array(

                'debug'=>false,

                'userTable'=>'user',

                'translationTable'=>'translation',

                'mailer'=>'PHPMailer',

                'facebookConfig'=>array(

                        'appId'=>'142433968341',

                        'secret'=>'a9f79372e1f945c0e0b743d9be8939f1',

                        'domain'=>'localhost',

                        'status'=>true,

                        'xfbml'=>true,

                        'cookie'=>true,

                        'lang'=>'en_US',)

                ),

                 'avatar'=>array(),


                'profile' => array(

                'privacySettingTable' => 'privacysetting',

                'profileFieldTable' => 'profile_field',

                'profileTable' => 'profile',

                'profileCommentTable' => 'profile_comment',

                'profileVisitTable' => 'profile_visit',

                 ),

                 'role' => array(

                'roleTable' => 'role',

                'userRoleTable' => 'user_role',

                'actionTable' => 'action',

                'permissionTable' => 'permission',

                 ),


                'registration' => array(

                 ),




                'gii'=>array(

                        'class'=>'system.gii.GiiModule',

                        'password'=>'codepac123',

                        // If removed, Gii defaults to localhost only. Edit carefully to taste.

                        'ipFilters'=>array('127.0.0.1','::1'),

                        'generatorPaths'=>array('bootstrap.gii',),

                ),


        ),


        // application components

        'components'=>array(

                'bootstrap'=>array(

                'class'=>'ext.bootstrap.components.Bootstrap',),

                'session'=>array(

                'sessionName'=>'SiteSession',

                'class'=>'CHttpSession',

'autoStart'=>true,

                ),

                 'cache'=>array('class'=>'system.caching.CFileCache'),

                        'user'=>array(

                        'class'=>'application.modules.user.components.YumWebUser',

                        // enable cookie-based authentication

                        'allowAutoLogin'=>true,

                         'loginUrl'=>array('//user/user/login'),

                ),

                // uncomment the following to enable URLs in path-format


                'urlManager'=>array(

                        'urlFormat'=>'path',

                        /*'rules'=>array(

                                '<controller:\w+>/<id:\d+>'=>'<controller>/view',

                                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

                                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

                        ),*/

                ),

                /*

                'db'=>array(

                        'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',

                ),

                // uncomment the following to use a MySQL database

                */




                'db'=>array(

                        'connectionString' => 'mysql:host=localhost;dbname=codepacu',

                        'emulatePrepare' => true,

                        'username' => 'root',

                        'password' => 'rwinkwavu',

                        'charset' => 'utf8',

                        'tablePrefix'=>'',

                ),


                'errorHandler'=>array(

                        // use 'site/error' action to display errors

                                                                                                                                           

'errorAction'=>'site/error',

        ),

                'log'=>array(

                        'class'=>'CLogRouter',

                        'routes'=>array(

                                array(

                                        'class'=>'CFileLogRoute',

                                        'levels'=>'error, warning',

                                ),

                                // uncomment the following to show log messages on web pages

                                /*

                                array(

                                        'class'=>'CWebLogRoute',

                                ),

                                */

                        ),

                ),

        ),


        // application-level parameters that can be accessed

        // using Yii::app()->params['paramName']

        'params'=>array(

                // this is used in contact page

                'adminEmail'=>'eliemagambo@gmail.com',

        ),

        'import'=>array('application.modules.user.models.*',

        'application.models.*',

        'application.components.*',),

);

                                                           

                                                          




                                                                                                                                           



Make sure your alias used in the views points to the right location - see here.

Is that the only module you’re having problems with? If so, I doubt it’s a problem with your config. Try a different module to check, if you haven’t already.

One thing to check; make sure you’re calling ‘TbNavbar’ rather than ‘TbNavBar’ or something if you’re using a Linux server as it’s case sensitive. This exact thing happened to me not long ago and it was only obvious when I pushed to a live server since I develop on Windows (which isn’t case sensitive).

It doesn’t seem to be a problem with the extension (component) but the widget.

Make sure it’s where it’s supposed to be; e.g.

/path-to-webapp/protected/extensions/bootstrap/widgets/TbNavbar.php

Are you still using an older version/download of yii-bootstrap? Then you don’t have TbNavbar.php but BootNavbar.php. That would result in above error message; or of course any type of misspelling. Good luck!

Great extension! Thank for share!