Wednesday, May 4, 2016

How to integrated web template into codeigniter 3.0.6 (with upgrade to 3.1.2)

Prerequistes:

After you extract codeigniter 3.1.2 you may have these structure directory:
[root codeigniter]
application
system
userguide
To upgrade codeigniter 3.0.6 to 3.1.2, extract codeigniter 3.1.2 and copy/replace system folder into [root codeigniter] folder. To upgrade from other version read this guide.
Extract your template into codeigniter folder [root codeigniter].
[root codeigniter]
application
system
userguide
fft--css
--fonts
--images
--js
--video
--index.html
--w3layouts-License.txt
Create file test.php file in folder controller.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Test extends CI_Controller {
  public function __construct() {
    parent::__construct();
  }
  public function view($page = 'Test')
  {
    $this->load->helper('html');
    $this->load->helper('url');
    if ( ! file_exists(APPPATH.'views/fft/'.$page.'.php'))
    {
      show_404();
    }
    $data['title'] = $page; // Capitalize the first letter

    $this->load->view('fft/templates/pageheader',$data);
    $this->load->view('fft/'.$page, $data);
    $this->load->view('fft/templates/pagefooter');
  }
}

?>
At folder views, create folder fft.
application
--------bodymenu.php

--------pageheader.php
------test.php
We split file views->test.php. The other supporting files we put them into folder  [root codeigniter]->application->templates.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!-- banner -->
  <div data-vide-bg="<?php echo base_url(); ?>fft/video/sea">
    <div class="center-container">
      <div class="container">
        <!-- load body header -->
        <?php $this->load->view('fft/templates/bodyheader'); ?>
        <div class="logo animated wow zoomIn" data-wow-delay="900ms">
          <h1><a href="/web/joomla/index.html">Frequent <span>flyer</span><i>take me anywhere</i></a></h1>
        </div>
        <div class="start animated wow bounce" data-wow-delay="700ms">
          <a href="#about" class="hvr-bounce-to-bottom scroll">Get Started</a>
        </div>
      </div>
    </div>
  </div>
Final directory will like this:
[root codeigniter]
------views
------templates
--------bodyheader.php
--------pagefooter.php
------about.php
------test.php
--system
--userguide
--fft
----css
----fonts
----images
----js
----video
----index.html
----w3layouts-License.txt

You can download zip file from http://www.garasiku.web.id/fft.zip and extract it into [root codeigniter]

References:

No comments:

Post a Comment