CodeIgniter Skeleton, submenus lost path to css and js -


i decided use codeigniter-skeleton-master (author anvoz) build web site. added new menus , sub menus on example. setup new menus haven't problem, because copy example of todo, make todo1 , works without problem. but, on added submenus entered under todo1 displayed web page cannot proper access css , js files , navbar displayed without css , js. problem caused site url() grab controller name todo1 , css , js in wrong path !

example:

todo1 ->path : http://localhost/ci3a/ ->this work ok instead used css , js path added onto , have acess files todo1/aboutus ->path : http://localhost/ci3a/todo1 ->this controller name-todo1 cause wrong path , css , js files cannot used!

organisation of files : application assets, contain css, images , js subfolders system

in application/config/ assets.php have:

$config['assets_url'] = 'assets/'; 

autoload.php have:

$autoload['helper'] = array('url'); 

config.php have:

$config['base_url'] = ''; $config['index_page'] = ''; 

routes.php have:

$route['default_controller'] = "skeleton"; $route['404_override'] = ''; 

in application/skeleton/ have controllers , views folders

in controllers folder have main controller skeleton.php

in application/views/header.php have navbar menu structure. here put copy of todo menu->todo1 2 submenus, work dont display css , js

        <li class="dropdown">              <a class="dropdown-toggle" data-toggle="dropdown" href="#">                  todo1 <b class="caret"></b>              </a>              <ul class="dropdown-menu">                  <li><a href="<?php echo site_url('todo1'); ?>">todo1</a></li>                  <li><a href="<?php echo site_url('todo1/aboutus'); ?>">about us</a></li>                   <li><a href="<?php echo site_url('todo1/whereweare'); ?>">where are</a></li>              </ul>          </li> 

i added similar functions index (in todo1.php controller) new submenuus)

public function aboutus()  {     $this->load->library('template');      $this->template->set_layout('pagelet');     $this->template->set_title('todo example');      $this->template->load_view('todo1/aboutus');  } 

i dont know how eliminate controller name make css, image , js unaccesible. tried make new folder todo1 under root , copy access subfolder problem stayed. in web browser, cought errors:

get http://localhost/ci3a/todo1/aboutus [http/1.1 200 ok 63ms] http://localhost/ci3a/todo1/assets/css/bootstrap.min.css [http/1.1 404  

not found 141ms] , x similar errors can me ?

to load css , js

<link href="<?php echo base_url(); ?>assets/css/bootstrap.css" rel="stylesheet" /> <script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js" type="text/javascript"></script> 

so folder structurer this

1. application 2. assets     - css         1. bootstrap.css     - js         1. bootstrap.js     - images         1. slider.jpg         2. logo.jpg 3. system 4. .htacess 5. index.php 

in controller load particular view only

public function aboutus() {     $this->template->set_title('todo example');    $this->template->load_view('todo1/header');    $this->template->load_view('todo1/aboutus');//this should contain details    $this->template->load_view('todo1/fotter'); } 

so in header.php file

<!doctype html> <html> <head>     <title>my site ----</title>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <link href="<?php echo base_url(); ?>assets/css/bootstrap.css" rel="stylesheet" />     <script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js" type="text/javascript"></script>  </head> 

in in fotter.php file

<div class="foot">     <div class="social">         <div class="news_letter">             <p>sign newsletter</p>             <div class="new_div">                 <form action="#" class="form_news" method="post">                     <input type="email" class="news_input" placeholder="e-mail" name="email" required>                     <input type="submit" class="news_button" value="subscribe" name="news_but" >                 </form>             </div>         </div>         <div class="follow">             <p>follow me</p>             <ul class="soc">                 <li><a class="soc-facebook" href="#" target="_blank"></a></li>                 <li><a class="soc-twitter" href="#"></a></li>                 <li><a class="soc-linkedin soc-icon-last" href="#"></a></li>             </ul>         </div>     </div>     <div class="clear"></div>     <div class="copyright navbar navbar-default">         <div class="copy_in">             <div class="foot_nav navbar-text">                 <ul>                     <a href="<?php echo base_url();?>"><li class="list_border">home</li></a>                     <a href="<?php echo base_url();?>index.php/aboutus"><li class="list_border">about us</li></a>                     <a href="<?php echo base_url();?>index.php/product"><li class="list_border">products</li></a>                     <a href="<?php echo base_url();?>index.php/corsair"><li class="list_border">corsair</li></a>                     <a href="<?php echo base_url();?>index.php/contact"><li>contact us</li></a>                 </ul>             </div>             <div class="foot_copy_text">                 <p class="navbar-text">                     © 2015 - comany name. solution : <a href="#" target="_blank">my office name</a>                 </p>             </div>         </div>     </div> </div> </body> 

in between (ex:about page)

<div class="container">      <h1>im us</h1>  <!-- rest of code here --> </div> 

ex: contact

<div class="container">      <h1>im contact</h1>     <!-- rest of code here --> </div> 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -