[Extension] Yiistrap

First of all: thank you for bringing bootstrap to yii! Your work is very appreciated;

Secondly, I would like to bring up a question: how do I define the submit-URL for the TbHtml::submitButton? I tried ‘url’ => and ‘submitUrl’, both inside the options-array as well as directly in the button - without getting it to work. Can someone throw a hint? Cudos in advance!

Edit: I would also be interestes in using bootstrap.less; I guess I would have to register the bootstrap.less-file from assets/less instead of bootstrap.css in the TbApi?

Hi,

Does anybody know how to properly add a TbHtml::navbarForm to a navbar? Specifically an AR form.

I’d like to add a login form to my navbar…

Thanks…

I hope this helps you, I came across it today. :D Happy coding……

Hello All,

[size=“2”]I am having a problem with TbNavbar, Tbnav, and dropdownmenus. The dropdown functions fine as long as it is viewed full screen. As soonas the menu goes responsive, the dropdown becomes disabled. I can see the itemsfine, I just can’t click them. If I turn ‘collapse’=>false, they are now functional,but the menu is not responsive anymore. This is a sample of my menu that Itried in a fresh install with no luck. [/size]

[size="2"]




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

			'color' => TbHtml::NAVBAR_COLOR_INVERSE,

			'brandLabel'=>CHtml::encode(Yii::app()->name),

                        'display' => null,

			'collapse'=>true, // requires bootstrap-responsive.css


			'items'=>array(

	                  array(

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

                    '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'=>'Test Dropdown', 'items' => array(

                                                array('label'=>'Test One', 'url'=>array('/site/index')),

                                                array('label'=>'Another One', 'url'=>array('/site/page')),

                                                array('label'=>'Three is the Charm', 'url'=>array('/site/contact')),

                                                )),


                                                    array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),

                                                    array('url'=>Yii::app()->getModule('user')->registrationUrl, 'label'=>Yii::app()->getModule('user')->t("Register"), 'visible'=>Yii::app()->user->isGuest),

                                                    array('url'=>Yii::app()->getModule('user')->profileUrl, 'label'=>Yii::app()->getModule('user')->t("Profile"), 'visible'=>!Yii::app()->user->isGuest),

                                                    array('url'=>Yii::app()->getModule('user')->logoutUrl, 'label'=>Yii::app()->getModule('user')->t("Logout").' ('.Yii::app()->user->name.')', 'visible'=>!Yii::app()->user->isGuest),

                                        ),                        

                                    ),

                                ),

       			)); ?>



[/size]

Hello,

I have an error




include(TbArray.php): failed to open stream: No such file or directory 



I have already followed the guide from http://www.getyiistrap.com to setup the yiistrap. below is my main.php config




<?php


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

// CWebApplication properties can be configured here.

return array(

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

    'runtimePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'runtime',

    'name' => 'MyInventory App',

    'aliases' => array(

        // yiistrap configuration

        'bootstrap' => realpath(__DIR__ . '/../extensions/yiistrap'), // change if necessary

        // yiiwheels configuration

        'yiiwheels' => realpath(__DIR__ . '/../extensions/yiiwheels'), // change if necessary

    ),

    // preloading 'log' component

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

    // autoloading model and component classes

    'import' => array(

        'application.models.*',

        'application.components.*',

        'bootstrap.helpers.TbHtml',

    ),

    'modules' => array(

        // uncomment the following to enable the Gii tool

        'gii' => array(

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

            'password' => 'gii',

            'gii' => array(

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

            ),

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

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

        ),

    ),

    // application components

    'components' => array(

        // yiistrap configuration

        'bootstrap' => array(

            'class' => 'bootstrap.components.TbApi',

        ),

        // yiiwheels configuration

        'yiiwheels' => array(

            'class' => 'yiiwheels.YiiWheels',

        ),

        'user' => array(

            // enable cookie-based authentication

            'allowAutoLogin' => false,

        ),

        '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>',

            ),

        ),

        ...

);




My directory structure is like this

myinv-app

|- protected

|- runtime

|- www

basically just moved runtime outside the protected and put index.php, index-test.php, assets folder to www.

I think the problem is with setting the bootstrap alias since I have no error when I use folder generated by yii.

Please help and thank you in advance.

Daniel

[/size]

I am getting an error close to that as well:




include(TbArray.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory




My problem starts with hitting an image,




<?php echo TbHtml::image($src=Yii::app()->baseUrl.'/landimages/corner_left.png', $alt='testt'); ?>




My system runs fine with an old version 1.1.1 from Yii’s site, but when I use the version that is on getyiistrap.com 1.2.0, I receive the error. Any help welcomed, thank you in advance.

Michael

I am kind of getting the solution with adding them to import, but not sure, is this correct solution?




'import' => array(

        'application.models.*',

        'application.components.*',

        'bootstrap.helpers.TbHtml',

        'bootstrap.helpers.TbArray',

        'bootstrap.behaviors.TbWidget',

    ),



I tested on very basic things and it worked.

Hi guys,

I’m just wonder concerning Widget ‘bootstrap.widgets.TbActiveForm’, there is always Labels next to FieldControlGroup items but how to insert fields with controls (showing errors in red if any) and not showing labels?

Ex:

Mail Address * {input field}

{error message shown here}

becomes:

{input field}

{error message shown here}

Nice work guys btw :)

Hello guys, how do I install this?

Hope this will help:

in main config, set path as follow:


'import'=>array(

		........

                'bootstrap.components.*',

                'bootstrap.behaviors.*',

                'bootstrap.helpers.*',

		.........

	),

It works for me.

Can i get some help with the imageCircle function? Im trying to maker the image smaller but I am having trouble.

<?php echo TbHtml::imageCircle(image url,’’, array(‘holder.js/140x140’) ); ?>

Couldnt post the actual img url because im a new poster.

Thanks.

Hi there,

I recently upgraded to Yiistrap 1.2.0 for the sake of integrating bootstrap inputs into yii’s Form Builder via the new TbForm class.

The issue here is that I can’t get the extended input elements to work :

The following returns an ugly "include(dropDownList.php): failed to open stream: No such file or directory" at rendering time




class XRuleForm extends TbForm

{

        ...	

	public function __construct($option,$model,$parent)

	{		

		$this->_xRuleClass = $xRuleClass = get_class($model);

		$xClass = $xRuleClass::$labelField;

		

		$config = array(

			'title'=>t($option['Game_Option']),

			'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,

			

			'elements'=>array(

				"{$xRuleClass::$idField}"=>array(

					'type'=>TbHtml::INPUT_TYPE_DROPDOWNLIST,

					'items'=>$xClass::lookup(),

					'visible'=>0, // defined during creation or save, doesn't need to be changed nor seen

				),

				'Rule_ID'=>array(

					'type'=>TbHtml::INPUT_TYPE_DROPDOWNLIST,

					'label'=>t($option['Game_Option_Desc']),

					'items'=>GamesOptionsRules::model()->lookupRules($option),

				),

			),

		);

		

		parent::__construct($config,$model,$parent);



while the following old school form definition works :




<?php $form=$this->beginWidget('TbActiveForm', array(

	'id'=>'clans-form',

	'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,

	'enableAjaxValidation'=>false,

)); ?>


<?php echo $form->textFieldControlGroup($model,'Full_name',array('size'=>60,'maxlength'=>256)); ?>


<?php echo $form->textFieldControlGroup($model,'Short_name',array('size'=>60,'maxlength'=>256)); ?>


...



Please note that in the first example, when i change types to ‘dropdownlist’ it works.

I read the extension source code and it seems that it uses the standard cForm logic, except when a non core type is found.

In such case, it calls a controller->widget with our specific input type and that is when it crashes.

Hope someone can save me more time diving into the source code.

Thank you Chris for developing the amazing Yii’s Bootstrap, Yiistrap. I’m new in bootstrap and need an example to create layout with Yiistrap. can somebody help me how to do it?

Hi, Chris.

Need help for use datepicker with yiistrap 1.3.0 and yiiwheels 1.0.4.

This my code :


<?php $tanggal = $this->widget('yiiwheels.widgets.formhelpers.WhDatePickerHelper', array(

                    'model' => $model,

                    'attribute' => 'CUR_DATE',

                    'inputOptions' => array('class' => 'input-medium'),

                    'name' => 'datepicker',

                    //'value' => '2000-01-01'

               ), true); 

            ?>

            <?php echo TbHtml::customControlGroup($tanggal, $model, 'CUR_DATE', array('span'=>6)); ?> 

And show this massage :


 Illegal string offset 'input' 

Why?

Hey there,

can anyone provide an example of a TbAffix implementation ?

@MistaMoh: this is what I have in my sidebar div:




<?php

	$panels=array();

	// General menu items

    $panels[] = array('label'=>Yii::t('app', 'Home'), 'url'=>'#', 'active' => true);

    $panels[] = array('label'=>Yii::t('app', 'Products'), 'url'=>'#');

    $panels[] = array('label'=>Yii::t('app', 'Listings'), 'url'=>'#');

?>

...

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

		    'offset' => TbHtml::AFFIX_POSITION_TOP,

		    ));/**/ ?>

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

				'type' => TbHtml::NAV_TYPE_LIST,

				'items'=>$panels,

				'htmlOptions'=>array('class' => 'your-custom-sidebar-classes', 'data-spy' => 'affix'),

				));

			?>

I strongly suggest starting from Yiistrap docs, I’ve managed making my layout work as expecteed by actually copying and customizing the layout used in those pages.

Hope this helps.

rash*

Thanks ! I’ll try asap and let you know

I just downloaded this extension, installed it, and IT SUCKS!!!!!!!

I followed the posted installation instruction, and WOW got a can’t find TbArray class. Modified ‘import’ in config to import helpers.*. Then it couldn’t find something else, like TbWidget missing. So if you are think of using this look somewhere else.

I’m sorry to be so blunt but hours to get something to work is just not exceptable. With Yii2 using Twitter Bootstrap I thought that I would start learning it, to be prepared for the switch, but I guess I’ll have to look elsewhere :(

I am new to yii/bootstrap as well and am trying to learn through yiistrap. I faced the same issues and finally realized that loading everything from bootstrap folder gets everything to work. Maybe you can optimize this later, but gets your through initially.

Modify \protected\config\main.php:




// autoloading model and component classes

'import'=>array(

   ...

   'bootstrap.components.*',

   'bootstrap.behaviors.*',

   'bootstrap.helpers.*',

   'bootstrap.widgets.*'

   ...

),

Hi, I ran into the exact same problem and moving my css after title fixed it, but I am wondering what the reason is for this? Did anyone figure it out?

Thanks for your post though! I am a newbie, would have spent hours trying to figure this out :)