Welcome Guest, Not a member yet? Register   Sign In
Integrating a Template with CodeIgniter 3
#1

I’m just wondering how can I integrate a webapp template, specifically AdminLTE3 with CodeIgniter 3 (3.1.13)?

I know the framework is a bit old but I’ve been trying to learn it for an old project I’m tasked to maintain and I’m lost as there isn’t any documentation or guide I can see that answers my question as I’d like to know the in and outs before meddling with it.

Thank you and have a good day!
Reply
#2

The same way you would for any view you just need to break up the AdminLTE template in to different views.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I am using AdminLTE as admin console and I have split the template in multiple files:
  • Topnavigation
  • leftnavigation
  • footer
  • and main page
On the main page all necessary css and scripts are loaded. Then I put the different template pieces together:


Code:
<body class="hold-transition skin-black sidebar-mini">
      <div class="wrapper">
        <?= $top_navigation ?>
        <?= $side_navigation ?>
          <div id="content">
            <div class="content-wrapper">
              <section class="content-header">
                <h1>
                  <?= $page_title ?>                 
                </h1>
                <ol class="breadcrumb">
                  <?php echo $breadcrumb; ?>
                </ol>
              </section>
              <?= $content ?>
            </div>
            <?= $footer ?>
          </div>
      </div>
</body>

I hope this helps you.
Reply
#4

instead of calling the view "maincontent", i've put in references to $content1, $content2, etc. Because we are doing if isset none of them are required. that way you can easily send more then one view file to the template. Or none at all if you are just showing a message, etc. Also notice that we have $templatefolder - that way you can easily reuse the template file for other site templates, even with the same content.

in your controller (similar to tutorial) it would be

$data['content01'] = 'codeigniterrawks';
$data['content02'] = 'mypetlion';
// beta template
$this->load->view( 'template_beta', $data );
note how easy it is if i want to bring in those same view files into a different template

$data['content01'] = 'codeigniterrawks';
$data['content02'] = 'mypetlion';
// alpha template
$this->load->view( 'template_alpha', $data );
Reply




Theme © iAndrew 2016 - Forum software by © MyBB