[Extension] Yiistrap

Great extension, as always.

Any guidelines on how to use TbHtml::navbarSearchForm ?

Does it have a ‘visible’ property? like other items in a TbNav

Thanks,

Hello YiiStrap team,

It looks like a great extension.

I started building a new site today, and started from bootstrap extension.

After I did setup for Bootstrap extension, I saw that it is not longer supported.

So I did setup for YiiStrap.

The setup process explained at getyiistrap looks simple.

I have done all the things explained.

Now when I load my application I get the message “Alias ‘bootstrap.helpers.TbHtml’ is invalid. Make sure it points to an existing directory or file.”

The file protected/extensions/boostrap/helpers/TbHtml.php is very well present in the server.

Any help will be appreciated.

This is my main.php config file:




<?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(

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

	'name'=>'Test site',




	// preloading 'log' component

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


    // path aliases

   'aliases' => array(

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

    ),


	// 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'=>'Enter Your Password Here',

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

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

		),*/


        'gii' => array(

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

        ),

		

	),


	// application components

	'components'=>array(


        'bootstrap' => array(

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

        ),


		'user'=>array(

			// enable cookie-based authentication

			'allowAutoLogin'=>true,

		),

		// 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=mmvnew',

			'emulatePrepare' => true,

			'username' => 'root',

			'password' => 'root',

			'charset' => 'utf8',

		),

		'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'=>'admin@test.com',

	),


);






anyone? pls help.

I compared with my working config file but found nothing wrong in yours.

Where do you get the error message? Is it at app configuration?

You can see screenshot at oi42.tinypic.com/2a0det5.jpg

Thanks in advance.

Yes it is in the config. Since your alias is well declared, I only see two possible causes :

  1. The relative part of your path is wrong (is your main config file in its original spot or any folder directly under protected?)

  2. The absolute part is wrong. Did you correctly rename your unzipped folder (in your sanity check from your first post you typed boostrap- missing t).

Good luck.

Hi!

When I use the TbGridView and set the ‘filter’ => $model , I see the fields to filter the data, but when I insert some text in these fields, the filter does not update the grid. Seems to be missing some script, but I dont know which one!

Someone can help-me, please.

  1. The relative part of your path is wrong (is your main config file in its original spot or any folder directly under protected?)

It is in protected/config/main.php only

  1. The absolute part is wrong. Did you correctly rename your unzipped folder (in your sanity check from your first post you typed boostrap- missing t).

The path I typed in this forum was a typo, but I see the path in application is correct.

Any other ideas?

This is how my alias looks like




'bootstrap' => realpath(__DIR__ . '/../../vendor/crisu83/yiistrap'),



My import has




    'bootstrap.helpers.TbHtml',



In config/main.php I also have




require_once( dirname(__FILE__) . '/../helpers/global.php');



bootstrap.widgets.TbNavbar :

How do we get a vertical divider and pull right the nav items?

Like ‘Responsive navbar’ http://getbootstrap.com/2.3.2/components.html#navbar

Found a solution




	<?php

	$this->widget(

		'bootstrap.widgets.TbNavbar', array(

	    'collapse' => true,

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

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

		    'items' => array(

			TbHtml::navbarMenuDivider(),

			array('label' => 'Login', 'url' => array('/site/login'), 'visible' => user()->isGuest),

			array('label' => 'Sign Up', 'url' => array('/site/signup'), 'visible' => user()->isGuest),

			array(

			    'label' => 'Logout (' . user()->name . ')',

			    'url' => array('/site/logout'),

			    'visible' => !user()->isGuest,

			),

		    ),

		    'htmlOptions' => array('class' => 'pull-right'),

		),

	    ),

		)

	);

	?>



I am having a seemingly trivial issue but I can’t figure out what’s wrong.

I installed Yiistrap & Yiiwheels on a new app. I updated the main.php config file as suggested but I am getting this error:

"PHP warning

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

/Users/vincent/Documents/Sites/yiiroot/framework/YiiBase.php(427)

"

if I remove the changes to main.php then my app works. With the suggested changes to the config file on I keep getting this error.

Any idea?

I’ve found my problem. I declared the “import” array twice. so 2nd time it deleted the first inputs.

How to set ‘well’ class when using TbForm ?

Here: http://www.getyiistrap.com/site/widgets#forms

the code has a typo:




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

'layout' => TbHtml::FORM_LAYOUTHORIZONTAL,

)); ?>



The constant name is TbHtml::FORM_LAYOUT_HORIZONTAL, with an add underscore

Hi!




<?php echo TbHtml :: popover ($ label, $ title, $ content, $ htmlOptions = array ()); ?>



Method works well if $ content as a string, and if the $ content such <img src="" />, then when you click on the button displays <img src="" /> as a string.

How can I fix it to display an image?

Thanks for the great extension!

Today I switched YII_DEBUG from true to false. TbApi (method registerCoreCss) should now register bootstrap.min.css instead of bootstrap.css but it doesn’t - while bootstrap-responsive.min.css (method registerResponsiveCss) gets registered perfectly. Any ideas what could cause that problem?

Upgrading from Yii Bootstrap to Yiistrap…

I am having a problem with TbHtml::Thumbnails. It generates two adjacent html elements with the same component id, causing conflict with ajax. The first element is a <div>, the second a <ul>. In the example below, my component id is "size_val1".

[html]<div id="size_val1" class="list-view items">

<ul id="size_val1" class="list-view items thumbnails">[/html]

Is this a bug or am I doing something wrong?

Many thanks

I finally figured it out:

My application had been created by Yiinitilizr which defined in config.main:




'clientScript' => array(

    'scriptMap' => array(

	'bootstrap.min.css' => false,

	'bootstrap.min.js' => false,

	'bootstrap-yii.css' => false

			)

),

So these scripts wouldn’t get registered by Yii::app()->bootstrap->register(). Instead Yiinitilizr had inserted these scripts in layouts.main and I decided to delete them before.

Hi All,

I really like the new grid system in Bootstrap 3. I understand that the version of Bootstrap can’t just be simply switched out in YiiStrap since lots of the widgets and dependant files rely on it, but I was wondering if the grid system could be swapped out. Is that possible? If so, how?