Objective
Objective

Reputation: 868

yii bootstrap (v2.0.3) extension invalid path alias

I followed the Yii-Bootstrap installation instructions on http://www.cniska.net/yii-bootstrap/setup.html but the path alias set in config/main.php doesn't work for me:

<?php
// path alias for bootstrap
Yii::setPathOfAlias('bootstrap',Yii::getPathOfAlias(dirname(__FILE__).'/../extensions/bootstrap'));
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
...

protected/extensions/bootstrap/... is my bootstrap directory.

If I want to use it in my layouts/main.php

Yii::app()->bootstrap->register();

it says "Alias "bootstrap.components.Bootstrap" is invalid. Make sure it points to an existing directory or file. "

I tried lots of stuff but can't get it to work. Any ideas?

Upvotes: 2

Views: 4224

Answers (3)

Adil
Adil

Reputation: 1

In my case i just renamed the protected/extensions/bootstrap/components/Bootstrap.php to protected/extensions/bootstrap/components/bootstrap.php

And everything works fine.

Upvotes: 0

NewsCloud
NewsCloud

Reputation: 1

I ran into this on my production server even though it worked fine locally.

The solution was to grant apache ownership to the yii installation:

sudo chown www-data:www-data -R /var/www/yourapp

previously ownership was root and apache couldn't see the files

Upvotes: 0

ventayol
ventayol

Reputation: 635

Have you tried to load bootstrap automatically on you config file? Add 'bootstrap' to you preload array. Here is mine:

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

Upvotes: 1

Related Questions