我想让Yiistrap(Yii框架的Bootstrap)在Cent OS 6.5上运行。我已将yiistrap-master解压缩到extensions / bootstrap中,并将以下内容添加到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'
),
我还将注册函数添加到protected / views / layouts / main.php
<?php /* @var $this Controller */ ?>
<?php Yii::app()->bootstrap->register(); ?>
这应该可以,但我一直遇到错误:
别名“bootstrap.components.TbApi”无效。确保它指向现有的PHP文件,并且该文件是可读的。
文件在那里且可读。我不确定会出现什么问题。
[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`
非常感谢您就此主题提供的任何帮助。
答案 0 :(得分:1)
我遇到了同样的问题。您可以修复它在main.php中为bootstrap配置所有必需的目录:
'import'=>array(
...
'bootstrap.helpers.*',
'bootstrap.widgets.*',
'bootstrap.behaviors.*',
),
答案 1 :(得分:1)
使用Yiistrap 1.3.0,我必须执行以下操作:
'import' => array(
'bootstrap.helpers.TbHtml',
'bootstrap.helpers.TbArray',
'bootstrap.behaviors.TbWidget',
'bootstrap.widgets.*'
)