Integrating HTML template into codeigniter

  • First create a folder “assets” in main folder for html template’s CSS, JS and Images
  • Paste all css and js files inside assets folder
  • Goto:- application>views> (create a test.php file and paste html code)
  • Open:- Application>config>autoload.php (Pass ‘url’ in helper array)
  • Open:- Application>config>autoload.php (Pass ‘database’,’session’ in libraries array)
  • Write the following code in your test function..
$this->load->view('admin-login');
  • After doing this call the url of test function, an html design will show in unmanaged format because its not getting css and js file’s link
  • Just write the following code for in all js and css link starting point
<?php echo base_url('assets /');?>

Example:
Including CSS files:
<link rel="stylesheet" href="<?php echo base_url('assets/');?>bootstrap/css/bootstrap.min.css">
Including JS Files:
<script src="<?php echo base_url('assets/');?>plugins/jQuery/jquery-2.2.3.min.js"></script>

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>