Template Library Version 1.4.1 |
[eluser]JoeWS[/eluser]
EDIT: Solved I am new to using hooks and didn't realize I needed this one important line: Code: $CI->output->_display(); --- I am having some issues with using the display_override hook. I get an error: "Cannot render the 'header' region. The region is undefined." when I try to set the header region. Here is what I am trying to accomplish: Whatever gets output by my application will get buffered and then sent to the 'content' region using Template Library 1.4.1. If the 'header' region is empty, I use the default header view for the 'header' region. If the 'footer' region is empty, I use the default footer view for the 'footer' region. My main files are listed below. The application is basically going to be an interactive site. The application name has been obfuscated. application/config/config.php Code: $config['enable_hooks'] = TRUE; application/config/hooks.php Code: $hook['display_override'] = array( application/config/template.php Code: $template['active_template'] = 'default'; application/hooks/Display.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); application/views/default_header.php Code: <h1>My App</h1> application/views/default_footer.php Code: <p>© 2011 My App</p>
[eluser]JoeWS[/eluser]
Side note: I did edit the constructor in application/libraries/Template.php from Code: function CI_Template() to Code: function CI_Template() because I was not getting any output to the browser at all. And the index file, in case you need to see it: application/views/index.php Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
[eluser]JoeWS[/eluser]
After stepping through the code a little more today, I think the problem may lie in me not understanding the display_override hook in CI rather than any issue with the Template library. It looks like my change to the constructor in CI_Template was causing the region error. I put that back to an include and now the error is gone but I still do not get any output to the page. If I use my template without the hook then everything works swimmingly.
[eluser]SpYk3[/eluser]
Question about "add_js" libraries/Template.php line 443 Wouldn't it make more since to change the operation in case someone is using their own method for creating js file location strings? For instance, I have an url_helper extension in almost all my proggies that includes direct links to my js, css and media folders and files with simple calls like "jsplugs_url('layout')" Somthing like Code: $filepath = (strpos($script, 'buff'.base_url()) ? $script : base_url().$script); or possibly even better, checking for possibly outside js files added in Code: $filepath = (strpos($script, "buffhttp://") ? $script : base_url().$script); ??? Just an idea. I'm still new to this thing, just dl'd it today so maybe i'll find better reasons not too
[eluser]Colin Williams[/eluser]
Template is a library, not a controller. It has no URI callback. To understand libraries better, visit http://ellislab.com/codeigniter/user-gui...aries.html
[eluser]greenflash[/eluser]
Fantastic library, very natural with CI, as it always should be with a plugin I was amazed that I could keep lines like the one below in my views/template.php and it still all would work fine. Code: <?php $this->load->view('layout\header');?> So I implemented in 3 minutes. Great. One thing, I guess it's just syntactic sugar but is it possible to make some changes to make method chaining possible? For example if write_view returns $this, I can do something like the stuff below: Code: // Prepare template, filling up region "content" with people_view + data & render
[eluser]staJr[/eluser]
Dear Colin Williams, Thanx you so much for your library ! It does a really good work A little question : Using your add_js & add_css methods, how can I echo $_styles & $_scripts NOT in a template file BUT within a view file I will load in a region (after) using the write_view method. I tried to put both add_js() & add_css() in a $data array used as a parameter by write_view() but it only output '1' (witch is expected). Thanxs for your help. Jean.
[eluser]Dani[/eluser]
Hi, Im new to both CI and template. I have created views/template.php and it works fine, but the file is starting to get rather big. What is the best practice to f.ex. put the menu in a separate file ? Should I use <?=include('menu.php')?> or <?=$this->load->view('menu.php')?> in the views/template.php file, or is there a better practice ?
[eluser]Unknown[/eluser]
This is the great library. I use it in all my projects. |
Welcome Guest, Not a member yet? Register Sign In |