CodeIgniter Forums
Template Library Version 1.4.1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Template Library Version 1.4.1 (/showthread.php?tid=12840)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


Template Library Version 1.4.1 - El Forum - 04-14-2009

[eluser]ironlung[/eluser]
Hey Colin / guys - great library!!! Smile

I need to get an ajax variable declaration into my template and I was hoping to use the $scripts variable to be able to do it, however the declaration needs to be exactly as follows

[removed]
//<![CDATA[
base_url='http://localhost:8888/index.php/home';
//]]>
[removed]

note the http address is being passed in a php variable.

with all the line breaks etc.

Can anyone suggest a way I can do this please? Its probably easy and as usual Im just stupid Smile


Kind regards


PS. I'm away for four days, so apologies if I don't reply straight away...


Template Library Version 1.4.1 - El Forum - 04-20-2009

[eluser]otherjohn[/eluser]
Is it possible to nest views?
I have a main view that is handleing products. The database calls each product and in the DB it has the name of the view to associate with the product. I would like to show that view inside the main view. How do I do this?


Template Library Version 1.4.1 - El Forum - 04-25-2009

[eluser]@Frédéric Quié - bleekom.org[/eluser]
Hi Collin,

You did a great job, but I suggest you to update your user guide to make the implementation of the Template Library clearer for the newbies, it will improve the use of it.

First change :
(For the sake of brevity, this example will be poorly structured HTML and make use of PHP short tags.)

If you use PHP4 it's perfect, but for PHP5 with no short tags turned on on CI, a better example would be, to include regions, with an echo statement :

Code:
<html>
   <head>
      <title><?php echo $title; ?></title>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>includes/css/template.css"/>
      
   </head>
   <body class="twoColHybRtHdr">
      <div id="container">
         <div id="header">
            &lt;?php echo $header; ?&gt;
         </div>
         <div id="wrapper">
            <div id="sidebar">
               &lt;?php echo $sidebar; ?&gt;
            </div>
            <div id="content">
               <h2>&lt;?php echo $title; ?&gt;</h2>
               <div class="post">
                  &lt;?php echo $content; ?&gt;
               </div>
            </div>
         </div>  
         <br class="clearfloat" />
         <div id="footer">
            &lt;?php echo $footer; ?&gt;
         </div>
      </div>
   &lt;/body&gt;
&lt;/html&gt;

Second change :
You should also mention one has to put in his construct controller the loading of the 'parser' library before your 'Template' library if we use by default the 'parser' library of CI :
Code:
function Page()
   {
      parent::Controller();
      $this->load->library('parser');
      $this->load->library('Template');
   }

Cheers !!!


Template Library Version 1.4.1 - El Forum - 04-25-2009

[eluser]@Frédéric Quié - bleekom.org[/eluser]
Oups Collin,

Why don't you provide in your dowload of the Template Library, a directory with the ressouces of the user guide example (i.e the CSS file) ? It would be great ;-)


Template Library Version 1.4.1 - El Forum - 04-25-2009

[eluser]Colin Williams[/eluser]
Thanks for the suggestions. I'm far from being able to maintain this right now, but I will try to not let this stuff fall off for too, long.

Quote:Is it possible to nest views?

You can nest a view in a region easily with the write_view() method. For deeper nesting, use the $this->load->view() method with a 3rd param of TRUE. This is covered extensively in the CodeIgniter user guide and on these forums.

Quote:I need to get an ajax variable declaration into my template and I was hoping to use the $scripts variable to be able to do it.

Does the following not work for you?

Code:
$script = "//&lt;![CDATA[\n";
$script .= 'base_url = "'. site_url('home') .'";';
$script .= "\n//]]>";
$this->template->add_js($script, 'embed');



Template Library Version 1.4.1 - El Forum - 05-07-2009

[eluser]rrasco[/eluser]
Have you encountered any conflicts with using sessions and template? I have one instance where a value is correct on one action, then on the next it is stored as something totally different. This only occurred after implementing Template.


Template Library Version 1.4.1 - El Forum - 05-08-2009

[eluser]Colin Williams[/eluser]
Template has no effect whatsoever on Sessions. There were probably more code changes than implementing Template that lead to your issue, rrasco.


Template Library Version 1.4.1 - El Forum - 05-08-2009

[eluser]rrasco[/eluser]
Yes, I have removed Template to eliminate it as the cause and it still happened. Not templates fault. Thanks.


Template Library Version 1.4.1 - El Forum - 05-10-2009

[eluser]sojic[/eluser]
I'm trying to "echo base_url()" into template... and it "stop" on that point.

Any hint??


Template Library Version 1.4.1 - El Forum - 05-10-2009

[eluser]Colin Williams[/eluser]
Load the URI helper