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

Jump to content

  • (45 Pages)
  • +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • 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

#121 User is offline   christoph 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 29-December 11

Posted 11 February 2012 - 05:15 AM

I just encountered a really weird "problem".
I received an error, the Path 'ext.bootstrap.components.Bootstrap' is invalid, make sure PHP file exists.

To fix it, I had to chmod 755 bootstrap (only the extension's "root" directory, everything within it was fine).

I don't know if this was maybe caused by some weird coincidence on my machine. (Might be OS X specific.)
I downloaded the .zip, it was auto-extracted by Safari, and I then just copied it into my Yii directory. Worked with all the other extensions. ;)

But just in case, anyone who gets this error, please make sure your webserver is actually allowed to read/execute the file.


By the way, there's a small typo in your documentation (installation): 'coreCss'=>true // whether to register the Bootstrap core CSS (bootstrap.min.css), defaults to true
, is missing after true. :)

Edit:
I think two things would be helpful for the documentation:
1) When using white icons within BootNavmenu, use 'icon'=>'icon-home icon-white'.
2) If you want to add properties to your <a>-Tag, e.g. for using modals, you can simply do this by adding 'linkOptions'=>array('data-toggle'=>'modal'), .

I think this is not 100% obvious, also since BootNavmenu seems not to extend CMenu. (I tried to set encodeLabel to false which didn't work.)
Thus, my first guess would have been to use CHtml::link()-options.

This post has been edited by christoph: 11 February 2012 - 06:15 AM

0

#122 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 11 February 2012 - 06:58 AM

Hi Chris,
A big thumb up for your extension. Really usefull.
New version of bootstrap extension is amazing.
Hey Ho !
Let's go !
0

#123 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 11 February 2012 - 10:49 AM

View Postchristoph, on 11 February 2012 - 05:15 AM, said:

I just encountered a really weird "problem".
I received an error, the Path 'ext.bootstrap.components.Bootstrap' is invalid, make sure PHP file exists.

To fix it, I had to chmod 755 bootstrap (only the extension's "root" directory, everything within it was fine).

I don't know if this was maybe caused by some weird coincidence on my machine. (Might be OS X specific.)
I downloaded the .zip, it was auto-extracted by Safari, and I then just copied it into my Yii directory. Worked with all the other extensions. ;)

But just in case, anyone who gets this error, please make sure your webserver is actually allowed to read/execute the file.


By the way, there's a small typo in your documentation (installation): 'coreCss'=>true // whether to register the Bootstrap core CSS (bootstrap.min.css), defaults to true
, is missing after true. :)

Edit:
I think two things would be helpful for the documentation:
1) When using white icons within BootNavmenu, use 'icon'=>'icon-home icon-white'.
2) If you want to add properties to your <a>-Tag, e.g. for using modals, you can simply do this by adding 'linkOptions'=>array('data-toggle'=>'modal'), .

I think this is not 100% obvious, also since BootNavmenu seems not to extend CMenu. (I tried to set encodeLabel to false which didn't work.)
Thus, my first guess would have been to use CHtml::link()-options.


Hey christoph,

You can set encodeLabel in the menu configuration. Here's an example:

<?php $this->widget('bootstrap.widgets.BootNavbar', array(
    'fixed'=>false,
    'brand'=>'Project name',
    'brandUrl'=>'#',
    'collapse'=>true, // requires bootstrap-responsive.css
    'items'=>array(
        array(
            'class'=>'bootstrap.widgets.BootMenu',
            'encodeLabel'=>false, // similar manner as you would with CMenu
            'items'=>array(
                array('label'=>'Home', 'url'=>'#', 'active'=>true),
                array('label'=>'Link', 'url'=>'#'),
                array('label'=>'Dropdown', 'url'=>'#', 'items'=>array(
                    array('label'=>'Action', 'url'=>'#'),
                    array('label'=>'Another action', 'url'=>'#'),
                    array('label'=>'Something else here', 'url'=>'#'),
                    '---',
                    array('label'=>'Separated link', 'url'=>'#'),
                )),
            ),
        ),
    ),
)); ?>

Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#124 User is offline   davey` 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 21-December 11

Posted 11 February 2012 - 06:57 PM

Hey chris,

You did a terrific job. I use your extension for my project, just migrated to 0.9.8 beta and it's splendid so far :)

Is there a easy way to use tooltips in the navbar?
0

#125 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 11 February 2012 - 08:13 PM

View Postdavey`, on 11 February 2012 - 06:57 PM, said:

Hey chris,

You did a terrific job. I use your extension for my project, just migrated to 0.9.8 beta and it's splendid so far :)

Is there a easy way to use tooltips in the navbar?


Yes, set the "rel" attribute on your anchor tags to "tooltip" and add a "data-title" attribute that contains the tooltip text.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#126 User is offline   christoph 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 29-December 11

Posted 12 February 2012 - 08:42 AM

View PostChris83, on 11 February 2012 - 10:49 AM, said:

Hey christoph,

You can set encodeLabel in the menu configuration. Here's an example:

Hi Chris,
thanks for this info, I actually put encodeLabel "too early" in the main configuration.

I have a little suggestions for the Brand in BootNavbar.php:
At line 50:
	/**
	 * Initializes the widget.
	 */
	public function init()
	{
		if ($this->brand !== false)
		{
            if ($this->brand === true)
            {
                $this->brand = CHtml::encode(Yii::app()->name);
            }


			if (!isset($this->brandUrl))
				$this->brandUrl = Yii::app()->homeUrl;
		}

		if ($this->collapse)
			Yii::app()->bootstrap->registerCollapse();
	}


That way, you can either use your application's name as the default if brand is set to true, or if you e.g. want to add a logo, you simply put your <img>-Tag there.

(Although I'm not sure if this is "nice code style" to mix boolean and string. ;))

Really great extension, it already helped me a lot!
0

#127 User is offline   Sep 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 12-February 12

Posted 12 February 2012 - 12:01 PM

Hello guys,

I am a newbie in Yii and I would like to add to my app this bootstrap extension. I did everything by the instructions on the homepage of this extension, but I am still getting the error
CException - Bootstrap and its behaviors do not have a method or closure named "registerCoreCss".


My main.php looks like:
	<?php echo Yii::app()->bootstrap->registerCoreCss(); ?>
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>


Forgot I for something important/missing I something yet?

Thanks in advance,
Sep
0

#128 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 12 February 2012 - 02:43 PM

View PostSep, on 12 February 2012 - 12:01 PM, said:

Hello guys,

I am a newbie in Yii and I would like to add to my app this bootstrap extension. I did everything by the instructions on the homepage of this extension, but I am still getting the error
CException - Bootstrap and its behaviors do not have a method or closure named "registerCoreCss".


My main.php looks like:
	<?php echo Yii::app()->bootstrap->registerCoreCss(); ?>
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>


Forgot I for something important/missing I something yet?

Thanks in advance,
Sep


If you're running the newest BETA version the setup instructions can be found here:
http://www.cniska.ne...trap/setup.html

Also, there is no need to call any methods in your main layout anymore, this is done automatically by the extension (see the example configuration on the setup page).
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#129 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 12 February 2012 - 02:46 PM

@christoph: The BootNavbar brand already behaves like you'd like it to, or at least it should. :) If you don't set it the app name will be used, if you set it to false the brand will be hidden and if you set it to anything but false that will be shown.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#130 User is offline   yiimann 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 19-December 09

Posted 12 February 2012 - 05:09 PM

Any release date for the new bootstrap version ?
0

#131 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 12 February 2012 - 07:00 PM

View Postyiimann, on 12 February 2012 - 05:09 PM, said:

Any release date for the new bootstrap version ?


Bootstrap 0.9.8 will be released in the beginning of next week. Beta testing is almost complete now.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#132 User is offline   rums 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 23-December 10

Posted 13 February 2012 - 02:14 AM

View PostChris83, on 12 February 2012 - 07:00 PM, said:

Bootstrap 0.9.8 will be released in the beginning of next week. Beta testing is almost complete now.


Might want to delay the 0.98 release? From Twitter:


"Heads up, nerds: new release coming out Monday or Tuesday with tons of bug fixes and more. Over 150 commits to the branch thus far!"

by Tw Bootstrap at 2012-02-13 12:07 AM

(Source: http://twitter.com/T...954341057765376)
0

#133 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 February 2012 - 04:28 AM

View Postrums, on 13 February 2012 - 02:14 AM, said:

Might want to delay the 0.98 release? From Twitter:


"Heads up, nerds: new release coming out Monday or Tuesday with tons of bug fixes and more. Over 150 commits to the branch thus far!"

by Tw Bootstrap at 2012-02-13 12:07 AM

(Source: http://twitter.com/T...954341057765376)


Yeah I noticed, I'll wait the release of 2.0.1 before releasing. :)
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#134 User is offline   ronanggl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 21-November 11
  • Location:Singapore

Posted 13 February 2012 - 04:35 AM

View PostChris83, on 09 February 2012 - 05:56 AM, said:

@guoliang86: Bootstrap requires jQuery 1.7.1, you're running an older version of Yii (1.1.9 comes with jQuery 1.7.1). Please update your framework and try again. This limitation is not in my extension but in Bootstrap itself as it uses jQuery.on.


Thanks Chris83, got it working.

I am trying to edit a module and make the layout compatible with bootstrap however i have encountered some problem which i dont understand on how can i get it implemented in bootstrap->bootMenu. attached are the code snippet hopefully someone can help me?

index.php
<?php echo $this->renderPartial('_menu', array(
		'list'=> array(
			CHtml::link(UserModule::t('Create User'),array('create')),
		),
	));
?>


_menu.php
<ul class="actions">
<?php 
	if (count($list)) {
		foreach ($list as $item)
			echo "<li>".$item."</li>";
	}
?>
</ul><!-- actions -->

<?php $this->widget('BootMenu', array(
    'type'=>'tabs', // '', 'tabs', 'pills' (or 'list')
    'stacked'=>false, // whether this is a stacked menu
    'items'=>array(
        array('label'=>UserModule::t('List User'), 'url'=>array('/user')),
        array('label'=>UserModule::t('Manage User'), 'url'=>array('admin')),
        array('label'=>UserModule::t('Manage Profile Field'), 'url'=>array('profileField/admin')),
    ),
)); ?>



is it possible to run a foreach in the array of bootMenu?
0

#135 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 February 2012 - 05:32 AM

@ronanggl: Sure, just build the items as a variable before calling the widget and pass it that variable instead of a static array.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#136 User is offline   kitune 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 121
  • Joined: 27-February 11

Posted 13 February 2012 - 06:30 AM

Hi! is avaliable all CSS styles and components in this extension? like split buttons http://twitter.githu...buttonDropdowns

thanks!
0

#137 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 February 2012 - 06:32 AM

View Postkitune, on 13 February 2012 - 06:30 AM, said:

Hi! is avaliable all CSS styles and components in this extension? like split buttons http://twitter.githu...buttonDropdowns

thanks!


Yes, but there ain't any widget for that... yet. :) Of course you can write the HTML yourself and it will work. Just make sure that you don't disable the button-plugin in the component configuration.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
2

#138 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 February 2012 - 08:29 AM

For everyone who's interested, I've pushed a branched called "bootstrap-2.0.1" which contains the latest build of Bootstrap 2.0.1 (Feb 12) which is not officially released yet.

I've tagged release 0.9.8 with the tag "r0.9.8" but I won't package that release for download because with Bootstrap 2.0.1 on the horizon, I will wait until it's released (which should be today or tomorrow) and release 0.9.9 instead.

With the new version out soon I'd like to thank everyone who helped with this project. I really appreciate it. :)
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

#139 User is offline   kitune 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 121
  • Joined: 27-February 11

Posted 13 February 2012 - 10:46 AM

Thanks for answer Chris. Do you think that bootstrap is good for a custom frontend design or is mainly for webapps like a backend.

Sorry for my english.
0

#140 User is offline   Chris83 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 440
  • Joined: 27-February 10
  • Location:Helsinki, Finland

Posted 13 February 2012 - 11:41 AM

View Postkitune, on 13 February 2012 - 10:46 AM, said:

Thanks for answer Chris. Do you think that bootstrap is good for a custom frontend design or is mainly for webapps like a backend.

Sorry for my english.

Personally I think that Bootstrap is good for almost any web app. There's already some sites that are built using Bootstrap. Some look a lot like Bootstrap and some look less. Check out http://builtwithbootstrap.com/.
Best regards,
Chris

My contribution to the Yii community:
Account | Yiistrap | Auth | Bootstrap | NordCms | Rights | LESS | SEO | Img

Follow me:
Twitter | GitHub | Bitbucket
0

Share this topic:


  • (45 Pages)
  • +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • 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