[EXTENSION] Bootstrap

Hi,

Unzip the extension in the directory


\protected\extensions\bootstrap

and post your


\config\main.php

to see

Guys, how do I make a field to feed “dropDownListRow” with data from a database table ???

I had done so


<?php

    $nivelusuario = CHtml::listData(NivelUsuario::model()->findAll(), 'id_nivel_usuario', 'desc_nivel');

    echo $form->dropDownListRow($model, 'id_nivel_usuario', array('prompt'=>'--Selecione--',$nivelusuario)); 

?> 

but appeared a zero field, as shown the img: imageshack.us/photo/my-images/109/errojo.jpg

what is the correct way?

Hola Gustavo,

the additional "prompt" has to go into htmlOptions - the 4th parameter:

dropDownListRow($model, ‘attribute’, dataArray, htmlOptionsArray).


echo $form->dropDownListRow($model, 'id_nivel_usuario', $nivelusuario, array('prompt'=>'--Selecione--'));

Saludos,

Don Felipe

Perfect!! Thanks my friend ^^

About the glyphs licensing issue: https://github.com/t...rap/issues/4485

It seems like it is ok to avoid the attribution note.

The problems with modal and resizing the browser will be adjusted in the new version?

This link is a nice find and it’s good to know that we do NOT have to add that link but are asked to if we want! Having said this, I wouldn’t mind if Chris added a link in the footer of the demo page/s. We should be glad we’re allowed to use the icons for free whatsoever. Afaik, “Glyphicons” is not mentioned at all on the demo page. Adding such link would provide more information about where the icons come from and maybe it’s useful for someone who wants to purchase the whole set in different colors hence some extra information won’t hurt anybody.

Thanks for the research, ekerazha.

Hello All, how to make sub menu like wordpress nav sub menu, images on attatcment file bellow??

3125

Screen shot 2012-08-22 at 4.20.34 PM.png

i try to make with this code





array('label'=>'Library', 'icon'=>'book', 'url'=>'#', 'type'=>'list', 'items'=>array(

									array('label'=>'Create Content', 'url'=>array('/library/create')),

									array('label'=>'Draft Content', 'url'=>array('/library/draft')),

									array('label'=>'Pending Content', 'url'=>array('/library/pending')),

							)),



but the result show is dropdown, not sub menu

3126

Screen shot 2012-08-22 at 4.36.16 PM.png

how to make sub menu like wordpress nav sub menu, like my first attachmnent image?

Hi All,

I would like to change the bootstrap.widgets.TbNavbar background color based on the Twitter 2.1.0 Wip guideline, but it doesn’t work (I’m trying with navbarBackground parameter)




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

			'id'=>'tbNavbar1',

			'navbarBackground'=>'blue',

    		'type'=>'inverse', // null or 'inverse'

Thanks for help.

"navbarBackground" is a variable used with LESS to generate the bootstrap.css file. One cannot use it as attribute and option for TbNavbar or any other widget. See this link on how LESS can be used together with bootstrap extension. You may also find useful information on how the 2 work together in this topic (previous posts) as well as the topic for LESS extension here.

Now, if you don’t want to spend too much time adding LESS to your webapp, you can quickly set an alternate background-color manually…




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

    'id'=>'tbNavbar1',

    'type'=>'inverse', // null or 'inverse'

    'htmlOptions'=>array('style'=>'background-color:blue;'),

You may also need to add ‘background-image:none;’ as the default class has a subtle gradient as background-image.

Hope it helps.

Felipe

Hi Felipe,

I trying with following code, but it still doesn’t work




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

    'id'=>'tbNavbar1',

    'type'=>'inverse', // null or 'inverse'

    'htmlOptions'=>array('style'=>'background-color:blue;'),

Oh sorry! Problem is, the widget will place another div (.navbar-inner) inside the main div (.navbar). The above htmlOptions will add style to .navbar but any bg-color and image set in .navbar-inner will appear above the ones defined in .navbar.

Workaround:

  • set a class in the above htmlOptions (e.g. ‘class’=>‘myNavbar’)

  • add the class’ styles as follows

.myNavbar .navbar-inner {

background-image:none;

background-color:blue;

}

  • you may need to check that your extra stylesheet is loaded after bootstrap.min.css. I usually register all additional css files at the bottom of the main view (layout) files so they are added last.

Cheers,

Felipe

Hi Chris!

Amazing release as usual! ;)

There’s an issue in TbAlert: with closeText=>false it gives an error

I’ve inserted this code at line #88 to solve




if (!isset($alert['closeText']))

    $alert['closeText'] = $this->closeText;



Setting ‘closeText’=>false works just fine on my side. Besides, check lines 116-120:


if ($this->closeText !== false && !isset($alert['closeText']))

    $alert['closeText'] = $this->closeText;


if ($alert['closeText'] !== false)

    echo '<a class="close" data-dismiss="alert">'.$alert['closeText'].'</a>'

What error message do you have on your side?

@chris83:

The sample source code for TbAlert widget on the demo page is missing 1 more closing bracket at the end.

It works well.

Thanks Felipe.

Regards,

Daniel

This is the error

"PHP notice

Undefined index: closeText"

with closeText=false

if ($this->closeText !== false && !isset($alert[‘closeText’])) is false so $alert[‘closeText’] doesn’t exists

You could have provided a little bit more information! It took me quite a while to reproduce this error/notice - reverse debugging.

It only happens -of course it shouldn’t happen at all- when many flash messages are declared first but not repeatedly listed in the alerts array while ‘closeText’=>false is only set for all the alerts globally.


<?php

Yii::app()->user->setFlash('success', '<strong>Well done!</strong> You successfully read this important alert message.');

Yii::app()->user->setFlash('info', '<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important.');


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

        'block'=>true, // display a larger alert block?

        'fade'=>true, // use transitions?

        'closeText'=>false,

        'alerts'=>array( // configurations per alert type

            'success'=>array('block'=>true, 'fade'=>true),// success, info, warning, error or danger

        ),

)); ?>

Yay!

I’m using only one alert!

Hi All,

how to add a login form on the dropdown of the Navbar? I would like to have similar to twitter login box. For user login (management) I used yii-user.

Thanks in advance.

hello, I’d like to use several checkboxes in form like this:




<?php

            echo $form->checkBoxListRow($model, 'checkboxes', array(

                '1' => 'Label 1',

                '2' => 'Label 2',

                '3' => 'Label 3',

            ));

            ?>



and save the values of checked checkboxes to database, but It saves the "Array" value, and while editing the post, no checkboxes are switched, are there any advices to solve this problem? Thanx