2013-02-28 3 views
1

저는 새로운 Yii 프로젝트에서 Yii-Bootstrap을 사용하고 있습니다. 나는 정확하게 설치 지침을 따랐다.Yii 부트 스트랩이 JS 파일을로드하지 않습니다.

첫 페이지에서 JS Carousel 플러그인을 사용하고 있습니다.

$this->widget('bootstrap.widgets.TbCarousel', array(
    'items'=>array(
     array(
      'image'=>'http://placehold.it/770x400&text=First+thumbnail', 
      'label'=>'asdf', 
      'caption'=>'Cras justo odio, ' 
     ), 
     array(
      'image'=>'http://placehold.it/770x400&text=Second+thumbnail', 
      'label'=>'asdf', 
      'caption'=>'Cras justo odio, ' 
     ), 
     array(
      'image'=>'http://placehold.it/770x400&text=Third+thumbnail', 
      'label'=>'asdf', 
      'caption'=>'Cras justo odio, ' 
     ), 
    ), 
)); 

Uncaught TypeError: Object [object Object] has no method 'carousel'

이것은 .carousel() 오류를 찾을 수 없습니다로 연결

. JS 파일이 등록되지 않은 것과 같습니다. CSS와 모든 것이 잘 보입니다.

나는 YII - 환경 확장을 사용하고

..

return array(

    // Set yiiPath (relative to Environment.php) 
    'yiiPath' => dirname(__FILE__) . '/../../../yii-1.1.13/framework/yii.php', 
    'yiicPath' => dirname(__FILE__) . '/../../../yii-1.1.13/framework/yiic.php', 
    'yiitPath' => dirname(__FILE__) . '/../../../yii-1.1.13/framework/yiit.php', 

    // Static function Yii::setPathOfAlias() 
    'yiiSetPathOfAlias' => array(
     // uncomment the following to define a path alias 
     'bootstrap' => realpath(dirname(__FILE__).'/../extensions/bootstrap') 
    ), 

    // This is the main Web application configuration. Any writable 
    // CWebApplication properties can be configured here. 
    'configWeb' => array(

     'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 
      'theme' => 'bootstrap', 

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

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

     // Application components 
     'components' => array(
      'bootstrap'=>array(
       'class'=>'bootstrap.components.Bootstrap', 
      ), 

어떤 제안이?

답변

4

당신은 특히 CSS와 JS를 등록해야합니다 : 그것은 확장 이전 버전에서 수행 된 방식과 다른

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

합니다. 왜 이것이 어디서나 문서에 언급되어 있지 않은지 나는 모른다.

전체 사이트/앱이 yii-bootstrap을 사용하는 경우 위의 코드 행을 배치하는 것이 좋습니다. 특정보기에서만이를 수행하는 경우 해당보기에 배치 할 수 있습니다.

P.S -이 기능은 부트 스트랩/구성 요소/Bootstrap.php 파일에서 찾을 수 있습니다.

+1

그래, 왜 여기에 언급되지 않습니까? 고마워, 내가 그걸 줄께. – Webnet

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

<?php Yii::app()->bootstrap->registerCoreScripts(); ?> 
<?php Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/styles.css'); ?> 
관련 문제