Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create tabbed UI in codeIgniter with jquery UI?

am using codeIgniter to develop a web app and for my UI, I want to use jQuery-UI-Tabs. I am locked down as to how to get my views to show up in their respective tabs. Any help?

like image 657
Don aMOEBa Avatar asked Jan 21 '26 08:01

Don aMOEBa


1 Answers

It depends on how you want to do it.

If you want to pre-load all the views separately, and have it there, then here's how:

In CodeIgniter:

$views['pageOne'] = $this->load->view('view_name', $data, true);
$views['pageTwo'] = $this->load->view('view_name2', $data, true);

in jQuery UI Tabs:

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Page 1</a></li>
        <li><a href="#tabs-2">Page 2</a></li>
    </ul>
    <div id="tabs-1">
        <?php echo $pageOne;?>
    </div>
    <div id="tabs-2">
        <?php echo $pageTwo;?>
    </div>

</div>

Another way would be the Ajax way.

<div id="tabs">
    <ul>
        <li><a href="link-to-controller">Page 1</a></li>
        <li><a href="link-to-controller">Page 2</a></li>
    </ul>
</div>
like image 82
tpae Avatar answered Jan 23 '26 21:01

tpae



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!