2016-06-14 5 views
0

私はYii2の新機能ですが、レイアウトページを作成しましたが、CSSが完全に機能しません。それはその部分だけを読み込みます。誰かが私を助けてくれる?yii2のCSSとブートストラップ

マイレイアウト:

<?php 
namespace app\views\layouts; 

use yii\bootstrap\Alert; 
use yii\bootstrap\ActiveForm; 
use yii\helpers\Url; 
use yii\helpers\Html; 
use yii\bootstrap\NavBar; 
use yii\bootstrap\Button; 
use app\models\Search; 
use yii\bootstrap\Nav; 
use app\assets\AppAsset; 
use app\models\LoginForm; 
use yii\web\View; 
use Yii; 

AppAsset::register($this); 
?> 
<?php $this->beginPage() ?> 
<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <meta name="language" content="en" /> 
    <?= Html::csrfMetaTags() ?> 
    <title><?php echo Html::encode($this->title); ?></title> 

    <link rel="shortcut icon" href="<?php echo Yii::getAlias('@web/themes/dcu') ?>/assets/images/favicon.png" type="image/x-icon" /> 


    <link rel="stylesheet" type="text/css" href="<?php echo Yii::getAlias('@web'); ?>/themes/dcu/assets/css/bootstrap.css" /> 
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::getAlias('@web'); ?>/themes/dcu/assets/css/bootstrap-responsive.min.css" /> 
     <link rel="stylesheet" type="text/css" href="<?php echo Yii::getAlias('@web'); ?>/themes/dcu/assets/css/gbu.csss" /> 
     <link rel="stylesheet" type="text/css" href="<?php echo Yii::getAlias('@web'); ?>/themes/dcu/assets/css/font-awesome.css" /> 

<?php $this->head()?> 
</head> 
<body> 
    <?php $this->beginBody() ?> 
    <span class="striept"></span> 
    <div id="wrap"> 
     <div class="container" id="page"> 
      <div class="row header"> 
       <div class="span7"> 
        <a href=<?php Yii::$app->homeUrl ?>><img src="<?php echo Yii::getAlias('@web'); ?>/themes/dcu/assets/images/documentatiecentrum-urk.png" /></a> 
       </div> 
       <div class="span5 login-form"> 
        <?php if (Yii::$app->user->isGuest): ?> 
         <div class="form"> 
         </div> 
        <?php else: ?> 
         <ul class="inline"> 
          <li>Je bent inlogd als: <?php echo Yii::$app->user->identity->username; ?> </li> 
          <li> 
          </li> 
         </ul> 
        <?php endif; ?> 
       </div> 
      </div> 
      <div class="row"> 
       <div class="span12 zoeken"> 
        <div class="input-append"> 

        </div> 
       </div> 
      </div> 

     </div> 

     <div class="container-fluid dark topmargin"> 
      <div class="container"> 
       <div class="row"> 
        <div class="span8"> 
         <h3>Onze partners</h3> 
         <div class="row-fluid"> 
          <div class="span4"> 

          </div> 
          <div class="span4"> 

          </div> 
          <div class="span4"> 

          </div> 
         </div> 
        </div> 
        <div class="span4"> 
         <div class="row-fluid"> 
          <h3>Ook meehelpen?</h3> 
          <p>Met uw steun zorgt u er samen met ons voor dat ons grote cultuurbezit, 'oenze taol', blijft bestaan!</p><p>Steun ons project en doneer een bedrag op onze bankrekening: 11.40.24.820 Rabobank Urk. Bedankt voor uw hulp!</p> 
          <a class="btn btn-primary" href="https://www.justgiving.nl/nl/charities/83-stichting-%20urker-taol" target="_new">Direct doneren</a> 
          <a class="btn btn-primary" href="<?php echo Yii::$app->basePath; ?>donateursformulier.pdf" target="_new">Donateursformulier</a> 
         </div> 
        </div> 
       </div> 
       <div class="row"> 
        <div class="span12 copyright"> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
    </body> 
    <?php $this->endBody() ?> 
</html> 
<?php $this->endPage() ?> 

私は他のすべてのCSSファイルがすべてOKであるため、問題は、bootsrapだと思います。

答えて

1

AssetBundle

などCSS、JS、として、アセットファイルのコレクションを表し

アセットバンドルは、他のアセットバンドルに依存する可能性があります。ビューにアセットバンドルを登録すると、そのアセットバンドルはすべて自動的に登録されます。

は、まず1 ThemeAsset AssetBunduleを作成してリンク

Yii2 AssetBundle API DOC

AssetBundle Example

の下に参照してください。今すぐあなたのビューファイル内ThemeAsset

<?php 
    use app\assets\ThemeAsset; 
    ThemeAsset::register($this); 
?> 
を登録

<?php 

    namespace app\assets; 
    use yii\web\AssetBundle; 

    class ThemeAsset extends AssetBundle 
    { 
     public $basePath = '@webroot'; 
     public $baseUrl = '@web'; 
     public $css = [ 
      '/themes/dcu/assets/css/bootstrap.css', 
      '/themes/dcu/assets/css/bootstrap-responsive.min.css', 
      '/themes/dcu/assets/css/gbu.css', 
      '/themes/dcu/assets/css/font-awesome.css', 
     ]; 
     public $js = [  
      .... 
      js file here 
      .... 
     ]; 
     public $jsOptions = [ 
      .... 
      js options here 
      .... 
     ]; 
     public $depends = [ 
      .... 
      dependent asset bundles here 
      eg: 'yii\bootstrap\BootstrapAsset' 
      .... 
     ]; 
    } 
?> 

0

すべての必要なファイルが必要なテーマ( "dcu")用のAssetBundleの作成をお勧めします。

AssetBundlesの作成の詳細についてはここを見て:Assets Key ConceptAssetBundle API doc

0

使用registerCssFileコンセプト

$this->registerCssFile("http://example.com/css/themes/black-and-white.css", [ 
    'depends' => [BootstrapAsset::className()], 
    'media' => 'print', 
], 'css-print-theme'); 
関連する問題