title: Add dynamic content to a template in code igniter
body: <p>I am trying a HTML/CSS file to convert to a template. I asked for help but I didn't receive any suggestions in that post yet I tried to figure out a way to create a template. I am having few glitches in doing that. My controller has main.php file which is the main page of the website, and I have register where the header, footer, and rest remain same except that main content changes when the page loads.</p>
  
  <p>I have the following template in the views folder:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head&gt;
     &lt;title&gt;&lt;?= $title ?&gt;&lt;/title&gt;
  
     &lt;style type="text/css"  &gt;
         @import url('&lt;?=base_url()?&gt;/includes/front.css');
         @import url('&lt;?=base_url()?&gt;/images/');
     &lt;/style&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
     &lt;div id="container"&gt;
         &lt;div id="header"&gt;
              &lt;?= $logo ?&gt; &lt;!--This is an image tag to display the image on the template --&gt;
              &lt;?= $topnav ?&gt;
         &lt;/div&gt;
  
         &lt;div id="menubar"&gt;
              &lt;?= $menulist ?&gt;
         &lt;/div&gt;
  
         &lt;div id="maincontent"&gt;
             &lt;?= $flashcontent ?&gt;
             &lt;?= $resources ?&gt;
             &lt;?= $registerForm ?&gt;
         &lt;/div&gt;
  
         &lt;div id="footer"&gt;
             &lt;div&gt;
                 &lt;?= $footertable1 ?&gt;
             &lt;/div&gt;
         &lt;/div&gt;
     &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In the       </p>
  
  <blockquote>
    <p>div id = maincontent</p>
  </blockquote>
  
  <p>This is the div tag which would be changing when a site loads. In my template I have included &lt;</p>
  
  <pre><code>&lt;?= $flashcontent ?&gt; &lt;?= $resource ?&gt; and  &lt;?= registerForm ?&gt;
  </code></pre>
  
  <p>The flashcontent and resources are supposed to be in the main page and registerForm is supposed to be shown when I click on register in the main page. I have been reading the template user guide in the code igniter but I am unable to understand how to make this dynamic. Please help me in getting over this issue.</p>
  
  <p>This is the template.php in config folder. </p>
  
  <pre><code>$template['active_group'] = 'default';
  $template['default']['template'] = 'template.php';
  $template['default']['regions'] = array(
     'title',
     'logo' =&gt; array(
          'content' =&gt; array(''),
          'name' =&gt; 'Logo',
          'wrapper' =&gt; '&lt;img&gt;',
          'attributes' =&gt; array('id' =&gt; 'logo')
      ),
      'topnav' =&gt; array(
          'content' =&gt; array(),
          'name' =&gt; 'Topnav',
          'wrapper' =&gt; '&lt;div&gt;',
          'attributes' =&gt; array('id' =&gt; 'topnav', 'class' =&gt; 'topnav')
      ),
      'menulist' =&gt; array(
          'content' =&gt; array('&lt;li&gt;
                              &lt;a href="#"&gt; Home &lt;/a&gt;
                              &lt;a href="#"&gt; Generator &lt;/a&gt;
                              &lt;a href="#"&gt; News &lt;/a&gt;
                              &lt;a href="#"&gt; Forum &lt;/a&gt;
                              &lt;a href="#"&gt; About &lt;/a&gt;
                              &lt;a href="#"&gt; Feedback &lt;/a&gt;
                              &lt;/li&gt;'),
          'name' =&gt; 'Menulist',
          'wrapper' =&gt; '&lt;ul&gt;',
          'attributes' =&gt; array('class' =&gt; 'menulist')
      ),
     'flashcontent' =&gt; array(
         'content' =&gt; array(''),
         'name' =&gt; 'Flashcontent',
         'wrapper' =&gt; '&lt;div&gt;',
         'attributes' =&gt; array('id' =&gt; 'flashcontent')
     ),
      'resources' =&gt; array(
         'content' =&gt; array(''),
         'name' =&gt; 'Resources',
         'wrapper' =&gt; '&lt;div&gt;',
         'attributes' =&gt; array('id' =&gt; 'resources')
     ),
      'registerForm' =&gt; array(
        'content' =&gt; array(),
          'name' =&gt; 'Registerform',
          'wrapper' =&gt; '&lt;div&gt;',
          'attributes' =&gt; array('id' =&gt; 'registerForm')
      ),
     'footertable1' =&gt; array(
         'content' =&gt; array('&lt;ul&gt; 
                              &lt;li&gt; &lt;a href="../main"&gt;Home&lt;/a&gt;
                              &lt;a href="#"&gt;News &amp; Events&lt;/a&gt;
                              &lt;a href="#"&gt;Forum&lt;/a&gt;
                              &lt;a href="#"&gt;About us&lt;/a&gt;
                              &lt;a href="#"&gt;Contact us&lt;/a&gt;
                              &lt;a href="#"&gt;Terms of use&lt;/a&gt;
                              &lt;a href="#"&gt;Privacy policy&lt;/a&gt;
                              &lt;a href="#"&gt;Site map&lt;/a&gt;
                              &lt;/li&gt;
                             &lt;/ul&gt;'),
         'name' =&gt; '',
         'wrapper' =&gt; '&lt;div&gt;',
         'attributes' =&gt; array('id' =&gt; 'footertable1')
     )
  );
  $template['default']['parser'] = 'parser';
  $template['default']['parser_method'] = 'parse';
  $template['default']['parse_template'] = FALSE;
  </code></pre>
  
  <p>Thanks in advance. </p>