Welcome Guest, Not a member yet? Register   Sign In
How to add sidebar?
#1

[eluser]Sein Kraft[/eluser]
I'm not using the template library and a iwant to know if i can put a sidebar. If not someone can put a simple example how to add a sidebar?

Regards,
Sein Kraft.
#2

[eluser]slowgary[/eluser]
I don't think this has anything to do with CodeIgniter. If you're not sure how to create a 'sidebar' as you call it, you should probably do some research on CSS floats (and CSS in general).

What exactly is your definition of a sidebar?
#3

[eluser]Mushex Antaranian[/eluser]
As I understand, you want to put sidebar in every page (or many pages) of your site and call it only once. Try to use this structure

Your views folder structure

views/index.php
views/header.php
views/footer.php
views/sidebar.php
views/some_page.php


where index.php is your master view and looks like this

Code:
<?php
//master view - index.php
$this->load->view('header');
$this->load->view($page);
$this->load->view('sidebar');
$this->load->view('footer')
?>

.. and your controller will look like this

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Some_controller extends Controller {
    
    function Some_controller()
    {  
    parent::Controller();
    }
    
    function index()
    {
        //put here view name you want load as main page
        $page = 'some_page';
        //put here any data to send to view
        $data['page'] = $page;
        //this will load your master view
        $this->load->view("bes/index", $data);
    }

}
/* End of file some_controller.php */
/* Location: ./your/controller/path/some_controller.php */

Wish it will help you Smile




Theme © iAndrew 2016 - Forum software by © MyBB