【问题标题】:CException in Yiistrap .Alias bootstrap.helpers.TbHtml" is invalidYiistrap .Alias bootstrap.helpers.TbHtml 中的 CException 无效
【发布时间】:2013-12-02 12:29:38
【问题描述】:

在我的 Web 应用程序中,我需要实现 yiistrap 。但我收到此错误并且无法纠正。别名“bootstrap.helpers.TbHtml”无效。确保它指向现有目录或文件。 我的配置/main.php

    <?php

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

// 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',
'aliases' => array(
        'bootstrap' => realpath(__DIR__ . '/protected/config/extensions/bootstrap'), // change this if necessary
    ),
    // preloading 'log' component
    'preload'=>array('log'),

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

    'modules'=>array(
        // uncomment the following to enable the Gii tool

        'gii'=>array(
            'class'=>'system.gii.GiiModule',
            'password'=>'xxxx',
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters'=>array('127.0.0.1','::1'),
'generatorPaths' => array('bootstrap.gii'),
        ),

    ),

    // 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',
                 'showScriptName' => false,
                 'rules'=>array(
                       '/'=>'/view',
                            '//'=>'/',
                         '/'=>'/',
                             ),             
                                ),


        /*
        'db'=>array(
            'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
        ),
                 */
        // uncomment the following to use a MySQL database

        'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=electrical',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => 'xxxxx',
            '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',
                ),
                */
            ),
        ),
'bootstrap' => array(
            'class' => 'bootstrap.components.TbApi',   
        ),
    ),


    // application-level parameters that can be accessed
    // using Yii::app()->params['paramName']
    'params'=>array(
        // this is used in contact page
        'adminEmail'=>'webmaster@example.com',
    ),
);

任何机构都请帮我解决这个问题。我无法继续。

【问题讨论】:

    标签: php twitter-bootstrap yii


    【解决方案1】:

    首先在您的/config/main.php 中定义它并制作bootstrap 别名

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

    TbHtml 不是标准的引导小部件之一,也许您需要从其他地方获取它并将其放在目录 /extensions/bootstrap/helpers/TbHtml 中,也许它是 YiiStraps 帮助器之一

    【讨论】:

    • 你必须使用 yii strap 来解决这个问题!我遇到了同样的错误:D
    猜你喜欢
    • 1970-01-01
    • 2015-07-24
    • 2012-12-05
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    相关资源
    最近更新 更多