[EXTENSION] Bootstrap Bringing together Yii and Twitter Bootstrap
#641
Posted 21 August 2012 - 06:10 AM
Hi, I am new to Yii and I want to install this extension, but I get this error, could you tell me how to fix it?
spanish
hola, soy nuevo en yii y me interesa instalar esta extension, pero me sale este error, podrian decirme como lo arreglo?
CException
Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable.
thanks
#642
Posted 21 August 2012 - 07:17 AM
lalo64, on 21 August 2012 - 06:10 AM, said:
Hi, I am new to Yii and I want to install this extension, but I get this error, could you tell me how to fix it?
spanish
hola, soy nuevo en yii y me interesa instalar esta extension, pero me sale este error, podrian decirme como lo arreglo?
CException
Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable.
thanks
Hi,
Unzip the extension in the directory
\protected\extensions\bootstrap
and post your
\config\main.phpto see
#643
Posted 21 August 2012 - 07:25 AM
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?
#644
Posted 21 August 2012 - 07:50 AM
Gustavo Andrade, on 21 August 2012 - 07:25 AM, said:
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
#645
Posted 21 August 2012 - 08:11 AM
Don Felipe, on 21 August 2012 - 07:50 AM, said:
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 ^^
#646
Posted 21 August 2012 - 11:19 AM
It seems like it is ok to avoid the attribution note.
#647
Posted 21 August 2012 - 01:25 PM
#648
Posted 21 August 2012 - 09:45 PM
ekerazha, on 21 August 2012 - 11:19 AM, said:
It seems like it is ok to avoid the attribution note.
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.
#649
Posted 22 August 2012 - 04:31 AM
Screen shot 2012-08-22 at 4.20.34 PM.png (10.8K)
Number of downloads: 11
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
Screen shot 2012-08-22 at 4.36.16 PM.png (10.54K)
Number of downloads: 10
how to make sub menu like wordpress nav sub menu, like my first attachmnent image?
#650
Posted 22 August 2012 - 10:02 AM
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.
#651
Posted 22 August 2012 - 12:14 PM
Daniel Chen, on 22 August 2012 - 10:02 AM, said:
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
#652
Posted 22 August 2012 - 09:37 PM
Don Felipe, on 22 August 2012 - 12:14 PM, said:
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;'),
#653
Posted 22 August 2012 - 11:58 PM
Daniel Chen, on 22 August 2012 - 09:37 PM, said:
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
#654
Posted 23 August 2012 - 02:08 AM
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;
#655
Posted 23 August 2012 - 02:23 AM
makro, on 23 August 2012 - 02:08 AM, said:
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.
#656
Posted 23 August 2012 - 09:58 AM
Don Felipe, on 22 August 2012 - 11:58 PM, said:
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
It works well.
Thanks Felipe.
Regards,
Daniel
#657
Posted 23 August 2012 - 10:03 AM
Don Felipe, on 23 August 2012 - 02:23 AM, said:
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.
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
#658
Posted 23 August 2012 - 11:31 AM
makro, on 23 August 2012 - 10:03 AM, said:
"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!
#659
Posted 24 August 2012 - 01:38 AM
Don Felipe, on 23 August 2012 - 11:31 AM, said:
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!
#660
Posted 27 August 2012 - 01:03 AM
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.

Help















