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 - 10-11-2010 [eluser]permanentbraindamage[/eluser] [quote author="victorche" date="1285767266"]@cryogenix, I am using it with CI 2.0 with no problems at all. Check your installation again and ask if you need help.[/quote] Anyone have problems with template write_view() function when using it in a controlloer loaded via Modules::run()? A clearer picture, let's say we have the following structure in modules folder. Module1 Module1/controllers Module1/views Module2 Module2/controllers Module2/views If we do a modules::run('module2/controller/function') from a controller in module1 folder, template->write_view() calls from module2 will use module1/views folder instead of the correct module2/views folder. Template's write_view() function is a shortcut for $this->load->view() and $this-template->write(). The problem I think lies with the template->write_view() code but I've no idea on how to fix it (yet). Currently I am using this very ugly workaround from inside module2, which defeats the whole purpose of using the Template class.. $this->template->write_view($region, '../modules/module2/views/someviewfile'); This ensures that any other module calling this module knows where to find the right view files. The alternative workaround is even more hideous.. $string = $this->load->view('someviewfile', '', true); $this->template->write($region, $string); Hope that someone here have a more elegant solution for this problem. Template Library Version 1.4.1 - El Forum - 10-20-2010 [eluser]Flightkid[/eluser] Get this problem: http://img197.imageshack.us/img197/4351/1285748584571.png Any help is appreciated, thanks in advance. Template Library Version 1.4.1 - El Forum - 10-21-2010 [eluser]WanWizard[/eluser] Your using $this->template, but the template library isn't loaded anywhere? Template Library Version 1.4.1 - El Forum - 10-21-2010 [eluser]Flightkid[/eluser] Ok wow dumb mistake thanks for the help. Fixed it by adding template to the autoload in the config. Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]momsenmeister[/eluser] I only started using the Template Library a day ago, so I'm a total newbie. I don't really understand how it is possible to nest templates in templates / views in views? It's no problem to nest views in template regions, but what if that view itself should behave like a template, and contain regions for example? In this example (which is not working, obviously) I want do demonstrate how I would like to write to the views regions first, and then nest this view in the template's region. Code: // This is, what I don't understand Any possibility to do something like this? How do you solve such a problem? Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]Phil Sturgeon[/eluser] You can do this with my Template library, but I call them Partials. Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]Vheissu[/eluser] [quote author="Phil Sturgeon" date="1288104893"]You can do this with my Template library, but I call them Partials.[/quote] Wow Phil, are my eyes deceiving me or did you finally create some documentation for your template library? Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]cryogenix[/eluser] hmmmm... do not get yourself confused with "template" and "views" when you're using this library. templates are, as the name implies, a template. like this: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" while a view can be anything you can put in the $header, $content, & $footer in my given example. like this for the $content (filename: welcome_message.php): Code: <p>[color=green]<?=$loadatexthere;?>[/color]</p> now now, you want to nest views you say? say for example you want another view loaded into your content view? well well, in my way of using this "awesome" library, i'd do it like this: Code: <?php if(!defined("BASEPATH")) exit("No direct script access allowed"); notice that for the main template, i only write to the main regions i have specified. and as for sub views, the traditional $this->load->view can be used. i hope you got what i'm talking about. i'm a little bit in a hurry as my work shift is nearing its end might edit this post at home later ciao! Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]Phil Sturgeon[/eluser] [quote author="Vheissu" date="1288105310"][quote author="Phil Sturgeon" date="1288104893"]You can do this with my Template library, but I call them Partials.[/quote] Wow Phil, are my eyes deceiving me or did you finally create some documentation for your template library?[/quote] The doctor said I have a bit of a fever and it should go away soon. Don't expect to be seeing too much more! :-p Template Library Version 1.4.1 - El Forum - 10-26-2010 [eluser]momsenmeister[/eluser] Thx a lot guys! Phil's library is probably exactly what I'm looking for, I'll give it a try... I hope not to get a fever, too - having to read through all that bulky documentation ;-) Thx, greets from Germany! |