问题
I am trying to get Yiistrap (Bootstrap for the Yii Framework) to work on Cent OS 6.5. I've unpacked the yiistrap-master into extensions/bootstrap and added the following to protected/config/main.php:
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// CWebApplication properties can be configured here.
return array(
'aliases'=>array(
'bootstrap'=>'/var/www/html/happytails/protected/extensions/bootstrap'
),
'import'=>array (
'bootstrap.helpers.TbHtml',
'components'=>array(
'bootstrap'=>array(
'class'=>'bootstrap.components.TbApi'
),
I also added the register function onto protected/views/layouts/main.php
<?php /* @var $this Controller */ ?>
<?php Yii::app()->bootstrap->register(); ?>
This should work but I keep running into the error:
Alias "bootstrap.components.TbApi" is invalid. Make sure it points to an existing PHP file and the file is readable.
File is there and readable. I am not sure what could be the issue.
[root@unknown000c29a635f6 extensions]# ls -l
total 4
drwxrwxrwx. 10 nobody nobody 4096 Feb 5 01:50 bootstrap
`[root@unknown000c29a635f6 bootstrap]# ls -l
total 112
drwxrwxrwx. 6 nobody nobody 4096 Feb 5 01:50 assets
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 behaviors
-rwxrwxrwx. 1 nobody nobody 296 Jan 29 14:40 codeception.yml
drwxrwxrwx. 2 nobody nobody 4096 Feb 6 20:29 components
-rwxrwxrwx. 1 nobody nobody 1075 Jan 29 14:40 composer.json
-rwxrwxrwx. 1 nobody nobody 54859 Jan 29 14:40 composer.lock
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 form
drwxrwxrwx. 3 nobody nobody 4096 Feb 5 01:50 gii
-rwxrwxrwx. 1 nobody nobody 555 Jan 29 14:40 Gruntfile.js
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 helpers
-rwxrwxrwx. 1 nobody nobody 1521 Jan 29 14:40 LICENSE.txt
-rwxrwxrwx. 1 nobody nobody 604 Jan 29 14:40 package.json
-rwxrwxrwx. 1 nobody nobody 370 Jan 29 14:40 README.md
drwxrwxrwx. 6 nobody nobody 4096 Feb 5 01:50 tests
drwxrwxrwx. 2 nobody nobody 4096 Feb 5 01:50 widgets`
Thank you very much for any help you can provide on this subject.
回答1:
I had the same problem. You can fix it configuring all required directories for bootstrap in your main.php:
'import'=>array(
...
'bootstrap.helpers.*',
'bootstrap.widgets.*',
'bootstrap.behaviors.*',
),
回答2:
With Yiistrap 1.3.0 I had to do the following:
'import' => array(
'bootstrap.helpers.TbHtml',
'bootstrap.helpers.TbArray',
'bootstrap.behaviors.TbWidget',
'bootstrap.widgets.*'
)
来源:https://stackoverflow.com/questions/21641401/yiistrap-configuration-issue