Yii Framework Forum: Yii-Bootstrap Don't Work For Me. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Bootstrap Don't Work For Me. Rate Topic: -----

#1 User is offline   i_can 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 20 April 2013 - 02:44 PM

Hello :)
So, before, you have to know that I am newbie with Yii.
Then, t'day, I tried to use Bootstrap with Yii, I followed all what is written on the Setup page of Yii-bootstrap, but it doesn't work with me!
I don't get any error, it's just that the stylesheet is not applied...I tried some code source from the Docs but without success!
Thanks for your help :)
0

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,082
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 20 April 2013 - 03:09 PM

Hi there

can you post some code
0

#3 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 20 April 2013 - 05:45 PM

Make sure you have this line in the main layout:

<?php Yii::app()->bootstrap->register(); ?>

0

#4 User is offline   i_can 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 21 April 2013 - 06:09 AM

View Postalirz23, on 20 April 2013 - 03:09 PM, said:

Hi there

can you post some code

Hi there :)
So, here's my files:

config/main.php :
<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Web Application',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules'=>array(
		// uncomment the following to enable the Gii tool
		
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'gii',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		
	),

	// application components
	'components'=>array(
		'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=test',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'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'=>'webmaster@example.com',
	),
	

);

	//Boostrap!==>
	return array(
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
    'modules'=>array(
        'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),
    ),
    'components'=>array(
        'bootstrap'=>array(
            'class'=>'bootstrap.components.Bootstrap',
        ),
    ),
);


And when I tried this following code, on the index page, just for testing, it didn't work (the stylesheet wasn't applied):
<?php $this->widget('bootstrap.widgets.TbButtonGroup', array(
    'buttons'=>array(
        array('label'=>'1', 'url'=>'#'),
        array('label'=>'2', 'url'=>'#'),
        array('label'=>'3', 'url'=>'#'),
        array('label'=>'4', 'url'=>'#'),
    ),
)); ?>

0

#5 User is offline   i_can 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 21 April 2013 - 06:11 AM

View Postandy_s, on 20 April 2013 - 05:45 PM, said:

Make sure you have this line in the main layout:

<?php Yii::app()->bootstrap->register(); ?>



Hi.
I did so, and I got this CException:
Property "CWebApplication.bootstrap" is not defined.


Thanks for your help guys:)
0

#6 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,082
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 21 April 2013 - 08:11 AM

andy_s he has already done the ext registration in his config


i_can can you see the bootstrap css file in your html page do view source and double check please
0

#7 User is offline   i_can 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 20-April 13

Posted 23 April 2013 - 03:25 AM

View Postalirz23, on 21 April 2013 - 08:11 AM, said:

andy_s he has already done the ext registration in his config


i_can can you see the bootstrap css file in your html page do view source and double check please


Hi :)
I checked the source page, and it seems like that the bootstrap css file is not loaded at all.
Here's the head bloc code:
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />

	<!-- blueprint CSS framework -->
	<link rel="stylesheet" type="text/css" href="/YiiTest/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="/YiiTest/css/print.css" media="print" />
	<!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="/YiiTest/css/ie.css" media="screen, projection" />
	<![endif]-->

	<link rel="stylesheet" type="text/css" href="/YiiTest/css/main.css" />
	<link rel="stylesheet" type="text/css" href="/YiiTest/css/form.css" />

	<title>WebLib</title>
</head>

0

#8 User is offline   ruderbytes 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 05-November 12
  • Location:Indonesia

Posted 17 May 2013 - 11:01 PM

have you already tried this?

Yii.Booster.Getting.Started

hope it help you
~Happy Coding~
0

Share this topic:


Page 1 of 1
  • 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