2013-02-28 2 views
0

테스트 yii 설치시 "Testdrive"애플리케이션을 만들 수있었습니다. I 생각해 보면 부트 스트랩을 설치했습니다.Yii에서 테마 활성화 및 부트 스트랩 설치

더 중요한 것은 내가 사용하고 싶은 테마를 활성화하는 데 어려움을 겪고 있습니다. 나는 찾을 수 있고 성공하지 않고 'theme' => 'xxxx'을 변경 한 모든 Yii 자습서를 살펴 보았습니다.

명백한 실수를 없애기 위해 파일/폴더 권한을 다시 확인했습니다.

URL입니다

데모 사이트 라이브가 http://www.pureads.co.uk/testdrive

나에게 아무것도 묻지 부담입니다 볼 나는 최선 내가 할 수있는 답변 해 드리겠습니다.

는 여기에 내가 내가 /testdrive/themes에 앉아했지만 작동하는 나타나지 않는 주제에 전화를을 시도해야하는 내 protected/config/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', 
    // preloading 'log' component 
    'preload'=>array('log'), 

    // autoloading model and component classes 
    'import'=>array(
     'application.models.*', 
     'application.components.*', 
    ), 
    'modules'=>array(
     // uncomment the following to enable the Gii tool 

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

    ), 

    // 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', 
      'rules'=>array(
       '<controller:\w+>/<id:\d+>'=>'<controller>/view', 
       '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', 
       '<controller:\w+>/<action:\w+>'=>'<controller>/<action>', 
      ), 
     ), 
     */ 
     'db'=>array(
      'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db', 
     ), 
     // uncomment the following to use a MySQL database 
     /* 
     'db'=>array(
      'connectionString' => 'mysql:host=localhost;dbname=testdrive', 
      'emulatePrepare' => true, 
      'username' => 'root', 
      'password' => '', 
      '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', 
       ), 
       */ 
      ), 
     ), 
    ), 

    // application-level parameters that can be accessed 
    // using Yii::app()->params['paramName'] 
    'params'=>array(
     // this is used in contact page 
     'adminEmail'=>'[email protected]', 
    ), 
    'theme'=>'andia-agency', // requires you to copy the theme under your themes directory 
    'modules'=>array(
     'gii'=>array(
      'generatorPaths'=>array(
       'bootstrap.gii', 
      ), 
     ), 
    ), 
    'components'=>array(
     'bootstrap'=>array(
      'class'=>'bootstrap.components.Bootstrap', 
     ), 
    ), 
); 
+0

'themes/andia-agency' 폴더의 내용은 무엇입니까? 당신은'components' 속성을 복제 할 필요가 없습니다. – dInGd0nG

+0

Assets이라는 폴더와 about, contact, index, portfolio & services라는 5 개의 html 파일이 있습니다. 자산 폴더에는 bootstrap, css, font-awesome, ico, img, js & prettyPhoto라는 폴더와 sendmail.php라는 파일이 있습니다. 감사. – Ross

+0

나는 최근 테마로 두통을 앓고 있었고 모든 것을 디버깅했다. XDebug가 많은 도움을 주었다. – acorncom

답변

2

귀하의 테마 폴더는 보호/뷰/ 폴더와 동일한 구조를 가져야한다. 따라서 테마는 다음과 같이 설정되어야합니다 (물론 루트 디렉토리와 관련이 있습니다).

  • 테마
    • 전망
    • 레이아웃 가끔 잘 작동하도록 '테마'설정 옵션을 받고 문제가

  • 사이트. 보통 CController :: beforeAction ($ action);에 내 컨트롤러의 다음 내용을 추가합니다.

    Yii::app()->setTheme('andia-agency'); 
    
  • 1

    당신이 당신의 <head></head> 섹션에

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

    을 포함나요?

    이것은 나를 위해 일했습니다. :)

    0

    부트 스트랩 테마 설치가 올바르지 않습니다. 올바른 방법은 yii-bootstrap setup에 설명되어 있습니다. 따라서 여러분이 보시다시피 config/main.php 파일의 첫 부분에 다음과 같이 주소를 정의해야합니다 :

    // Define a path alias for the Bootstrap extension as it's used internally. 
    // In this example we assume that you unzipped the extension under protected/extensions. 
    Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap'); 
    return array(
    'theme'=>'bootstrap', // requires you to copy the theme under your themes directory 
    'modules'=>array(
        'gii'=>array(
         'generatorPaths'=>array(
          'bootstrap.gii', 
         ), 
        ), 
    ), 
    'components'=>array(
        'bootstrap'=>array(
         'class'=>'bootstrap.components.Bootstrap', 
        ), 
    ), 
    ); 
    
    관련 문제