Monday, October 5, 2015

Yii 1 - Membuat Sticky Footer

Cara membuat agar footer tetap berada dibawah pada yii. lanjut dari tutorial mengganti tema yii default ke yii bootstrap kita akan membuat sticky footer.

Caranya buka bootstrap.css di d:\xampp\htdocs\[webapp]\protected\extensions\bootstrap\ tambahkan css berikut:

 html {  
   height: 95%;  
   //other css  
 }  
 body {  
   height: 95%;  
   //other css  
 }  
 .wrap {  
   min-height: 100%;  
   height: auto;  
   margin: 0 auto -60px;  
   padding: 0 0 60px;  
 }  
 .wrap > .container {  
   padding: 70px 15px 20px;  
 }  
 .footer {  
   height: 45px;  
   background-color: #f5f5f5;  
   border-top: 1px solid #ddd;  
   padding-top: 20px;  
 }  
 .pull-right {  
  float: right !important;  
 }  
 .pull-left {  
  float: left !important;  
 }  
Setelah itu buka main.php di folder d:\xampp\htdocs\[webapp]\themes\bootstrap\views\layouts\ dibagian body ikuti penulisan seperti dibawah ini atau copy paste coding dibawah langsung.
 <body>  
     <?php  
     $this->widget('bootstrap.widgets.TbNavbar', array(  
       'items' => array(  
         array(  
           'class' => 'bootstrap.widgets.TbMenu',  
           'items' => array(  
             array('label' => 'Home', 'url' => array('/site/index')),  
             array('label' => 'About', 'url' => array('/site/page', 'view' => 'about')),  
             array('label' => 'Contact', 'url' => array('/site/contact')),  
             array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),  
             array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)  
           ),  
         ),  
       ),  
     ));  
     ?>  
     <div class="wrap">  
       <div class="container">  
         <?php if (isset($this->breadcrumbs)): ?>  
           <?php  
           $this->widget('bootstrap.widgets.TbBreadcrumbs', array(  
             'links' => $this->breadcrumbs,  
           ));  
           ?><!-- breadcrumbs -->  
         <?php endif ?>  
         <?php echo $content; ?>  
         <div class="clear"></div>  
       </div>  
     </div>  
     <footer class="footer">  
       <div class="container">  
         <p class="pull-left">Copyright &copy; <?= date('Y'); ?> by CV.INDAKO TRADING CO.</p>  
         <p class="pull-right"><?= Yii::powered(); ?></p>  
       </div>  
     </footer><!-- footer -->  
   </body>  
Setelah itu simpan dan refresh tampilan web anda jika tidak ada perubahan hapus semua folder di d:\xampp\htdocs\[webapp]\assets\ tidak usah takut menghapusny karena folder itu akan di generate ulang setiap anda merefresh aplikasi anda.

Selamat Mencoba.

1 comment:

  1. Use this diet hack to drop 2 lb of fat in just 8 hours

    At least 160 thousand women and men are using a easy and secret "water hack" to drop 1-2 lbs each and every night while they sleep.

    It is proven and it works all the time.

    Just follow these easy step:

    1) Get a clear glass and fill it half full

    2) Now use this strange hack

    and you'll be 1-2 lbs skinnier when you wake up!

    ReplyDelete