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) |
Template Library Version 1.4.1 - El Forum - 07-28-2010 [eluser]jmanpa[/eluser] I figured it out and will share the results here: 1) short tags, as used in Template code examples, were not working with my ci and Apache config (not allowing short tags). I had to set $config['rewrite_short_tags'] = TRUE; in the config.php file. 2) I had ordered these incorrectly and footer was defined in both with the last one understandably overriding the second (the second had an empty footer): $template[‘default’][‘regions’][‘footer’] = array( ‘content’ => array(‘c 2010 mycompany’) ); $template['default']['regions'] = ... Template Library Version 1.4.1 - El Forum - 08-19-2010 [eluser]Billy Khan[/eluser] Having a wierd problem with this library, My code: Code: $header_data['user'] = $this->ion_auth->get_user(); When i try and loop round $videos within video_manager.home.php, it stops parsing and doesnt output main.header.php ,main.footer.php. As soon as i replace my loop with a simple echo "hello"; it works. Why would looping round my dataset stop all templates from parsing? Using mamp / php 5.3.2 Template Library Version 1.4.1 - El Forum - 08-19-2010 [eluser]Billy Khan[/eluser] Scratch that, my bad. get_videos() was booged. Template Library Version 1.4.1 - El Forum - 08-19-2010 [eluser]cryogenix[/eluser] [quote author="Dave Hunt" date="1278641623"]Great library, but I have one question. You have an example in the documentation where you only ever use one header and footer for a template, so you configured: Code: $template['default']['regions']['header'] = array('content' => array('<h1>CI Rocks!</h1>')); Is there a way to do this, except to grab a view file instead of just putting text in the config file itself?[/quote] I'll do it like this: Code: <?php I will then place this in my application's libraries folder and let it be autoloaded using this magic function which I added at the bottom of my application's "config.php" (I forgot where I got this but I just copied it at some thread here in the CI forums): Code: /* This way, I now have an always existing library. I can just let it be extended by the controller of whatever page that needs the default header and default footer. Say for example the index page: Code: <?php if(!defined("BASEPATH")) exit("No direct script access allowed"); So there you have it. This approach can also be applied for other uses such as securing pages that require authentication by simply extending something like a Protected_Page_Controller wherein that controller contains some session checking logic. Template Library Version 1.4.1 - El Forum - 09-27-2010 [eluser]ITT-Nico[/eluser] Hey guys, i was just wondering if it is possible to read the content of a region? Just because of some idea im having... Thx Template Library Version 1.4.1 - El Forum - 09-27-2010 [eluser]WanWizard[/eluser] If you want to do it correctly, add this Code: function get_region($name) But as all class properties are public, you can also access them directly Code: echo $this->template->regions[$name]['content']; Template Library Version 1.4.1 - El Forum - 09-27-2010 [eluser]ITT-Nico[/eluser] Okey THx! Template Library Version 1.4.1 - El Forum - 09-29-2010 [eluser]cryogenix[/eluser] has any1 tried using this btw for CI2? i seem to be having some problems trying to make it work. i've copied the package in their respective folders, configured the template config, all pretty much like how i used to do it in CI 1.7.2. but all i get is an undefined variable $template when i try to call $this->template well of course I know that it's not meant for use with CI2 yet but I would just like to know if someone already managed to make it work and how? Template Library Version 1.4.1 - El Forum - 09-29-2010 [eluser]victorche[/eluser] @cryogenix, I am using it with CI 2.0 with no problems at all. Check your installation again and ask if you need help. Template Library Version 1.4.1 - El Forum - 09-29-2010 [eluser]cryogenix[/eluser] nvm... i found out it i wasn't using modular extensions hmvc properly *forgot to change extends Controller to extends MX_Controller |