CodeIgniter Forums
Template Library Version 1.4.1. Need help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Template Library Version 1.4.1. Need help (/thread-33736.html)



Template Library Version 1.4.1. Need help - El Forum - 09-06-2010

[eluser]prashid[/eluser]
Hi,

I am new to CI and struggling to learn. I was checking Template Library Version 1.4.1 and downloaded it to use with CI 1.7.2.

Code:
Problem is template.php is loading but CONTENTS not filling. Below what I have done
  
   1.  /libraries/Template.php
      Move to your application /libraries/ folder.
   2. /config/template.php
      Move to your application /config/ folder.
   3. /views/template.php
      Move to your application /views/ folder.
      
    4. application/config/template.php //Added below code
      $template['default']['regions'] = array(
        'content',
        );
    5.application/views/basic.php //This code
    <strong>Name:</strong> &lt;?= $name ?&gt;
    6.application/views/fancy.php //This code
    <strong>Fancy Name:</strong> &lt;?= $name ?&gt;  
    7.application/views/template.php //This code
        &lt;html&gt;
           &lt;head&gt;
           &lt;/head&gt;
           &lt;body&gt;
                &lt;?= $content ?&gt;
           &lt;/body&gt;
        &lt;/html&gt;
    8.application/controller/basic.php //This code
    &lt;?php
        class Basic extends Controller {

            function Basic()
            {
                parent::Controller();
            }

            function index()
            {

            }

                function show_name()
                {
                   $this->load->library('template');

                   $data = array('name' => 'John');
                   $this->template->write('content', 'fancy', $data, 'basic');
                   $this->template->render();
                }
        }

    ?&gt;
    9. When I am trying to call show_name function using URL
    http://localhost/ci_test/index.php/basic/show_name
    
    I see in page view source below
    &lt;html&gt;
       &lt;head&gt;
       &lt;/head&gt;
       &lt;body&gt;
        &lt;?= $content ?&gt;
       &lt;/body&gt;
    &lt;/html&gt;
    
    CONTENT not filling.
    
    Any idea what is missing?



Template Library Version 1.4.1. Need help - El Forum - 09-07-2010

[eluser]Eric Barnes[/eluser]
Try &lt;?php echo $content; ?&gt; instead.