Phil Sturgeon's Template Library? - 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: Phil Sturgeon's Template Library? (/showthread.php?tid=27748) |
Phil Sturgeon's Template Library? - El Forum - 04-16-2010 [eluser]hugle[/eluser] Hello Phil and others I came with some problems here.. For example I have module, called 'categories'. In the controller of this, module, I do: Code: $this->template->set_theme('admin'); I get the error: Code: Unable to locate the file: categories/topnav.php Code: /application/themes/admin/views/topnav.php Later I tried to put this file into: Code: /application/modules/categories/views/topnav.php - no such error, all works OK. How I can make Module use a theme? or maybe it is not possible? Thank you very much! Phil Sturgeon's Template Library? - El Forum - 04-17-2010 [eluser]Phil Sturgeon[/eluser] Application/themes/views/modules/modulename/whatever.php Phil Sturgeon's Template Library? - El Forum - 04-17-2010 [eluser]hugle[/eluser] [quote author="Phil Sturgeon" date="1271512588"]Application/themes/views/modules/modulename/whatever.php[/quote] strange, but I can't get it to work... (admin is theme name) I did: Code: $this->template->set_theme('admin'); I tried: Application/themes/views/modules/modulename/whatever.php Application/themes/views/modules/modulename/views/whatever.php Application/themes/admin/views/modules/modulename/whatever.php Application/themes/admin/views/modules/modulename/views/whatever.php Application/themes/admin/modules/categories/whatever.php Application/themes/admin/modules/categories/views/whatever.php -- nothing worked my temalate.php config is the default one. What I am trying to to, is that I need a little app, with and admin backend. for heavier projects I use Pyro. But I came to a solution, that it's a time to start using templates, it's cleaner, easier to adapt to new projects/designs. I looked threw Pyro for examples, and started using Template Library I have an example controller 'categories' (extending Admin_Controller) - admin.php and one controller is extending Public_Controller - categories.php Code: these both files located in same directory: now when I want for example build a 'form.php' view which is located at: /app/modules/categories/controllers/views/form.php I have also this layout: /app/themes/admin/views/layout.php So when I do: Code: $this->template->set_theme('admin'); Shouldn't it work? Maybe I'm missleading you, and miss understanding something... So I decided to describe whole problem... Thank you! Phil Sturgeon's Template Library? - El Forum - 04-28-2010 [eluser]MrCevic[/eluser] Hi Devon, I've been trying different ways of using Phil's library following the comments in this thread and playing with PyroCms with no success. Would you be so kind as to tell us how you made it work for you? I won't mind writing some documentation if I can make it work! Just in case, here's what I've done: 1 - Dropped Template.php "system/application/libraries" 2 - Created a MY_Controller.php in "system/application/libraries" with the following code: Code: <?php (defined('BASEPATH')) OR exit('No direct script access allowed'); Code: <?=doctype()?> Code: <?php Here's what I get: Quote:A PHP Error was encountered Fine. Just in case I go and modify my welcome.php controller and add "$this->load->library('template');" just after "parent::Controller();". This is what I get: Quote:An Error Was Encountered Phil Sturgeon's Template Library? - El Forum - 04-28-2010 [eluser]Phil Sturgeon[/eluser] Application/themes/admin/views/modules/modulename/whatever.php should be fine. "it doesn't work" is not very descriptive about the actual problem you are getting. Error messages? Screenshots? Phil Sturgeon's Template Library? - El Forum - 04-28-2010 [eluser]MrCevic[/eluser] Hi Phil, I've just updated my question with more information on how I'm using your library and the problems I'm finding. Phil Sturgeon's Template Library? - El Forum - 04-28-2010 [eluser]hugle[/eluser] [quote author="MrCevic" date="1272487877"]Hi Phil, I've just updated my question with more information on how I'm using your library and the problems I'm finding.[/quote] I had similar problems as yours... I have made some modifications to template.php library earlier... Could you try my attached file and see if it helped you? Btw. When you are setiing up layout as layout.php you should later use: build('index.php') for example and the content of 'build' you can get by: putting: <?php echo $template['body'];?> in layout.php... Just play with it, see PyroCMS examples Phil Sturgeon's Template Library? - El Forum - 04-29-2010 [eluser]MrCevic[/eluser] Hi Hugle, I tried the library but it didn't solve my problem. I'm still getting the "Unable to locate the file: layout.php" error. I'm using "<?php echo $template['body'];?>" in my template as you can see from the description of my setup above. I also tried to replace "layout" with "index.php" in $this->template->build('layout', $data); but get the same error "Unable to locate the file: index.php" Phil Sturgeon's Template Library? - El Forum - 04-29-2010 [eluser]Phil Sturgeon[/eluser] The newest version has changed to store layout files in: Quote:application/themes/default/views/layouts/default.php Probably should have mentioned that to somebody at some point... Phil Sturgeon's Template Library? - El Forum - 04-29-2010 [eluser]MrCevic[/eluser] Hi Phil, I don't know if your last reply referred to my post. Just in case I 1- went and created a "layouts" folder in "application/themes/default/views" 2- placed inside a copy of my "layout.php" and renamed it "default.php" 3- tried to run the code as it was and also modifying the controller "welcome.php" from "$this->template->build('layout', $data);" to "$this->template->build('default', $data);" but I'm still getting the "Unable to locate the file: default.php (or template.php)" |