Yii Framework Forum: [EXTENSION] Bootstrap - Yii Framework Forum

Jump to content

  • (45 Pages)
  • +
  • « First
  • 34
  • 35
  • 36
  • 37
  • 38
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] Bootstrap Bringing together Yii and Twitter Bootstrap Rate Topic: ***** 23 Votes

#701 User is offline   pdtkame 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 03-April 09
  • Location:Vietnam

Posted 18 September 2012 - 05:05 AM

Great extension! Thank for share!
0

#702 User is offline   Diegorgp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-July 12

Posted 18 September 2012 - 09:32 AM

Hello guys!

Anyone can help me?

Error: Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable.

I unzip the extension in the directory: \protected\extensions\bootstrap

Main.php:

Quote

<?php

return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Supplier Quality Management',

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

'import'=>array(
'application.models.*',
'application.components.*',
),

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

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

'user'=>array(
'allowAutoLogin'=>false,
'loginUrl'=>array('site/login'),
),

'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=sqm',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),

'errorHandler'=>array(
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
),
),
),

'params'=>array(
'adminEmail'=>'webmaster@example.com',
),
);


Thanks!
Diego Rodrigo
0

#703 User is offline   radoo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 05-September 11
  • Location:Bucharest / Romania

Posted 18 September 2012 - 09:44 AM

Quick question.I am using the TbGridView exactly as described in the demo and everything is fine.
However I cannot figure out how to display more than 10 records, and to display some navigation buttons to go to the next X(10) records.
I suspect this might be related to my limited knowledge on YII, but it looks trivial so I hope someone will be kind enough to help a newbie.Thanks.
Small web application software company.
Using Yii as the framework of choice.
0

#704 User is offline   gv0zd 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 06-April 12

Posted 18 September 2012 - 11:04 AM

Hi. Thank you for extension.
I have TbButtonColumn in TbGridView.
Is it possible to use popover behavior with buttons in this column?

I have try different ways

<?php
$this->widget('bootstrap.widgets.TbGridView', array(
    'type'=>'striped bordered condensed',
    'dataProvider'=>$userHistory,
    'template'=>"{items}",
    'columns'=>array(
        array('header'=>'#', 'name'=>'id'),
...
        //1st way
        array(
            'header'=>'Test',
            'type'=>'html',
            'value'=>"$this->widget(
                'bootstrap.widgets.TbButton', 
                array(
                    'label'=>'Click me',
                    'type'=>'danger',
                    'htmlOptions'=>array(
                        'data-title'=>'A Title', 
                        'data-content'=>'And here\'s some amazing content. It\'s very engaging. right?',
                        'rel'=>'popover'
                    ),
                )
            )"
        ),
        //2nd way
        array(
            'header'=>'Actions',
            'class'=>'bootstrap.widgets.TbButtonColumn',
            'htmlOptions'=>array('style'=>'width: 50px; text-align: center;'),
            'template'=>'{info}',
            'buttons'=>array(
                'info' => array(
                    'label'=>'Info',
                    'icon'=>'info-sign',
                    'url'=>'"#"',
                    'htmlOptions'=>array('data-title'=>'A Title', 'data-content'=>'And here\'s some amazing content. It\'s very engaging. right?', 'rel'=>'popover'),
                ),
            ),
        ),
    )
));

1st way gives me "Property "SomeController.widget" is not defined."
2nd doesn't give me any result. Botton steal have tooltip behavior :(
0

#705 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 18 September 2012 - 04:37 PM

How do you bind a TbTypeahead to a model? I've tried the following, but it does not work.

<?php $this->widget('bootstrap.widgets.TbTypeahead', array(
  'model' => Department::model(),
  'attribute' => 'department_name',
  'options'=>array(
    'items'=>4,
    'matcher'=>"js:function(item) {
      return ~item.toLowerCase().indexOf(this.query.toLowerCase());
    }",
  ),
)); ?>

0

#706 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 19 September 2012 - 08:55 AM

Hello!

Have you had problems with render error messages when the forms are validated by AJAX?

How to solve?
0

#707 User is offline   akimoff 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-September 12

Posted 20 September 2012 - 01:33 AM

Hi!
I may repeat, but I have a problem. The fact is that when I use the Cyrillic cp1251 in yii-bootstrap (whether in the menus, buttons), the words disappear. I set utf-8 encoding. In other words, it does not work in Cyrillic UTF-8.

Thanks in advance!
0

#708 User is offline   spidaboy7 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 19-April 12
  • Location:Rwanda,Kigali

Posted 20 September 2012 - 04:30 AM

View PostDon Felipe, on 16 September 2012 - 10:31 PM, said:

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!


Hey,you were right,i only have BootNavbar.php,is it the old version or the newest?,because i used the one i `ve found at www{dot}cniska{dot}net{slash}yii-bootstrap thanks a lot,its good to belong to community!
0

#709 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 20 September 2012 - 04:57 AM

View Postspidaboy, on 20 September 2012 - 04:30 AM, said:

Hey,you were right,i only have BootNavbar.php,is it the old version or the newest?,because i used the one i `ve found at www{dot}cniska{dot}net{slash}yii-bootstrap thanks a lot,its good to belong to community!


Please use one of the downloads on the right hand side of this link.

yii-bootstrap-1.x => widgets.Tb... (new)
yii-bootstrap-0.9.x => widgets.Boot... (old)

The 1.x versions are not backward compatible! As of now there is no reason to use the older version when starting a new project, so please use 1.1. If you update a existing webapp from 0.9 to 1.x simply search and replace all .php files under /protected and replace "bootstrap.widgets.Boot" with "bootstrap.widgets.Tb".
0

#710 User is offline   Lothor 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 05-August 11
  • Location:Brazil

Posted 20 September 2012 - 06:54 AM

View PostLothor, on 19 September 2012 - 08:55 AM, said:

Hello!

Have you had problems with render error messages when the forms are validated by AJAX?

How to solve?


For some reason unknown to me, the errors returned by performAjaxValidation are not listed on the forms that use ajaxSubmit the end of the request.

To solve this, I created the following function:

function showAjaxValidationMessages(response) {
    for (idInput in response) {
	while(response[idInput]) {
	    $('#' + idInput + '_em_').empty().html(response[idInput][0]).fadeIn('low');
	    break;
	}
    }
}

In ajaxOptions:

'ajaxOptions' => array(
    'dataType' => 'json',
    'success' => "function(response) {
	showAjaxValidationMessages(response);
    }",
),

0

#711 User is offline   akimoff 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-September 12

Posted 20 September 2012 - 07:53 PM

View Postakimoff, on 20 September 2012 - 01:33 AM, said:

Hi!
I may repeat, but I have a problem. The fact is that when I use the Cyrillic cp1251 in yii-bootstrap (whether in the menus, buttons), the words disappear. I set utf-8 encoding. In other words, it does not work in Cyrillic UTF-8.

Thanks in advance!


i set Yii::app()->charset='cp1251'; in view, but its not worked when i set charset value in config
0

#712 User is offline   spidaboy7 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 19-April 12
  • Location:Rwanda,Kigali

Posted 24 September 2012 - 10:10 AM

Hello,@Don Felipe,thx for greats tips,you really saved me here,i am actually having some issue with url routing while using TbMenu widget,i am using the format of /moduleId/ControllerId/ActionId in accessing module Controllers,here is an example
<?php  $this->widget('bootstrap.widgets.TbNavbar', array(
    'type'=>'inverse', // null or 'inverse'
    'brand'=>'CODEPAC',
    'brandUrl'=>'#',
    'collapse'=>true, // requires bootstrap-responsive.css
    'items'=>array(
        array(
            'class'=>'bootstrap.widgets.TbMenu',
            'items'=>array(
                array('label'=>'Home','url'=>array('/site/index'), 'active'=>true),
                array('label'=>'About', 'url'=>array('/site/page')),
                array('label'=>'Contact us','url'=>array('/site/contact')),
            ),
        ),
        '<form class="navbar-search pull-left" action=""><input type="text" class="search-query span2" placeholder="Search"></form>',
        array(
            'class'=>'bootstrap.widgets.TbMenu',
            'htmlOptions'=>array('class'=>'pull-right'),
            'items'=>array(
                array('label'=>'Sign in', 'url'=>'/user/auth','visible'=>Yii::app()->user->isGuest),
                '---',
               [b] array('label'=>'Profile', 'url'=>'/user/user','visible'=>!Yii::app()->user->isGuest, 'items'=>array([/b]
                    [b]array('label'=>'Settings', 'url'=>'user/user/index'),[/b]
                    [b]array('label'=>'Logout', 'url'=>'user/user/logout')[/b],

                )),
            ),
        ),
    ),


the three last line are the ones that are causing problem,when i try to access those links after clicking on home,page,contact us(using the Site controller actions that are auto-generated by the Yii) the route is appended to the existing url in stead of creating a new url to the module,for example if am on home page(after clicking home it has this as url http:localhost/mysite/index.php/site/index)it gives me this url http://localhost/mys...r/user/index,if i go the same link again with this as url it gives me http://localhost/mys...user/user/index if i click again it add another one again and again..but the strange in all is that it works fine with CMenu,here is snippet of CMenu that works fine,
<?php $this->widget('zii.widgets.CMenu',array(
                        'items'=>array(
                                array('label'=>'Home', 'url'=>array('/site/index')),
                                array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
                                array('label'=>'Contact', 'url'=>array('/site/contact')),
                                array('label'=>'Login', 'url'=>array('//user/auth'), 'visible'=>Yii::app()->user->isGuest),
                                array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('//user/user/logout'), 'visible'=>!Yii::app()->user->isGuest),
                                array('label'=>'My profile ', 'url'=>array('/user/user/'), 'visible'=>!Yii::app()->user->isGuest),
                        ),
                )); ?>



i am assuming that it might be caused by the fact that those links are submenu but i am not sure since the first in those links is not submenu and has the same problem!thank you again
0

#713 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 24 September 2012 - 12:15 PM

@spiderboy7:

uhm, there's a huge difference between:
'url'=>array('/site/faq')
'url'=>array('site/faq')
'url'=>'/site/faq'
'url'=>'site/faq'

the first 2 will look for a controller route -defined as rules of the urlManager in main config.php- and return an absolute link. you can also easily append additional ids (url parameter) this way.

the latter 2 will treat 'url' as a simple string, and the value will be returned without any change.
<a href="/site/faq">
<a href="site/faq">
it should be obvious by now why some of your links don't work. the leading '/' is missing. when you're in '/site/faq' and click on 'site/faq' the browser will request '/site/site/faq' and so on and on.

hope it helps. it's already late here and i'm too tired for typing.


---edited/added next morning---

here's some basic info about URL management in Yii:

CHtml::link
CHtml::normalizeUrl
CController::createUrl
and
URL Management

have a nice day!
0

#714 User is offline   spidaboy7 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 19-April 12
  • Location:Rwanda,Kigali

Posted 25 September 2012 - 07:17 AM

hey @Don Felipe..thanks again for your tips..i needed the first actually since i needed a route to the module and controller,thanks again..it worked fine!i have to read a bit about url Managment thought!
0

#715 User is offline   Diegorgp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-July 12

Posted 25 September 2012 - 12:55 PM

Hello guys!

Anyone can help me?

Error: Alias "ext.bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing PHP file and the file is readable.

I unzip the extension in the directory: \protected\extensions\bootstrap


Main.php:

<?php

return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Supplier Quality Management',

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

'import'=>array(
'application.models.*',
'application.components.*',
),

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

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

'user'=>array(
'allowAutoLogin'=>false,
'loginUrl'=>array('site/login'),
),

'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=sqm',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
),

'errorHandler'=>array(
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
),
),
),

'params'=>array(
'adminEmail'=>'webmaster@example.com',
),
);


Thanks!
Diego Rodrigo
0

#716 User is offline   spidaboy7 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 19-April 12
  • Location:Rwanda,Kigali

Posted 26 September 2012 - 04:13 AM

hello Diego,i think your configuration is fine,maybe you should check if you are not using the old version of Yii-bootrap,here is the link to the new oneget the newest version
0

#717 User is offline   Diegorgp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-July 12

Posted 26 September 2012 - 05:37 AM

View Postspidaboy7, on 26 September 2012 - 04:13 AM, said:

hello Diego,i think your configuration is fine,maybe you should check if you are not using the old version of Yii-bootrap,here is the link to the new oneget the newest version


i'm very stupid!!!

i had done the download on bootstrap site, not the yii extension, now it's working!

Thanks a lot!!
0

#718 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 26 September 2012 - 08:14 AM

Is the Bootstrap-Wysihtml5 plugin included (http://jhollingworth...trap-wysihtml5/)? If so, is there a usage example somewhere?
0

#719 User is offline   Timbo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 19-January 10

Posted 27 September 2012 - 07:14 AM

Is there a way to append a button to an input, as demonstrated in the Bootstrap documentation? The closest I have got is to assign the button code to the htmlOptions append property:

<?php
    $this->beginClip('searchBtn');
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon'=>'icon-search',
        'type'=>'info',
        'url'=>'#lookupModal',
        'htmlOptions'=>array(
            'rel'=>'popover', 
            'data-toggle'=>'modal')
        ));
    $this->endClip();
?>
<?php echo $form->textFieldRow($model, 'memberName',
    array(
        'class'=>'span5',
        'readonly'=>true,
        'append'=>$this->clips['searchBtn'],
    ));
?>



All this does is to render the button in a text add-on area. What I want is for the button to be appended directly to the input.

Can anybody help me with this?

Thanks!
0

#720 User is offline   Don Felipe 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 02-January 11
  • Location:Saigon, Vietnam

Posted 27 September 2012 - 08:42 AM

View PostTimbo, on 27 September 2012 - 07:14 AM, said:

Is there a way to append a button to an input, as demonstrated in the Bootstrap documentation? The closest I have got is to assign the button code to the htmlOptions append property: [...]


Timbo, your approach is too complicated. Just render the 2 elements as usual and put a div around it.
Something like this... (untested but should work)

<div class="input-append">
  <?php echo $form->textFieldRow($model, 'attribute', array('class'=>'input-medium')); ?>
  <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'button', 'label'=>'Go')); ?>
</div>


If you need another input or button just put another widget inside the parent div. If you want to get rid of the annoying label of the input (yes you do); the answer can be found in a previous post above and not so long ago.

Cheers,
DF
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 34
  • 35
  • 36
  • 37
  • 38
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users