Welcome Guest, Not a member yet? Register   Sign In
Template Library Version 1.4.1
#61

[eluser]Colin Williams[/eluser]
Thanks, JayTee. Hope it works out for you. If you run into any issues or have some feature requests, drop in here or PM me.
#62

[eluser]JayTee[/eluser]
I fixed it - everything was working properly.

I had a call to write to the variable tucked away in a nested view and forgot to delete it.
#63

[eluser]Colin Williams[/eluser]
When you remove the region from config, are you also removing ALL calls to write to the region?

$this->load->vars() and the Template Class have no direct correlation.
#64

[eluser]JayTee[/eluser]
Sorry - I feel like an idiot - it was my fault, not the library
#65

[eluser]Ysekim[/eluser]
I really like this library, thank you Colin Smile

I'm using it with Matchbox and I think it works really well with modular structure. Of course, I can't use the write_view() method with modules because most of the view files are in some folder like modules/<module_name>/views, but I think it is just as easy to do this:


Code:
$this->template->write('content', $this->load->view('someview', $data, TRUE));


Personally, I added some "\n" to those add_css and add_js methods, just to make the final HTML look a little bit nicer Smile
#66

[eluser]MeDHaT[/eluser]
Hi All,

firstly, Thanks for the nice template library,Colin Smile

Is there any way to replace all config variables with their values without specifying the region?
as example: I need to retrieve image_path value from configs array and use it in my header,content and footer regions. should I copy $this->template->write 3 times?

on another note, maybe we can write a function to automatically parse all config vars with the shape {var} with their corresponding values if found in any region file, on template render as example. that will save us a lot of code, I think.

Thanks in advance.

Note: I'm new to CI, so I'm not sure if this can be done in a different way.
#67

[eluser]Colin Williams[/eluser]
Either use $this->load->vars() or config_item() to get more general variables.
#68

[eluser]Nabeel[/eluser]
Looks like an interesting class, though I kinda did this in just MY_Controller.php:

Code:
public function template_set($view, $data='', $slice='content')
{
    $this->content[$slice] .= $this->load->view($view, $data, true);
}
    
/**
* Show the complete page output, including header/footer and all
*  Template base is the folder from which to call (set in module __construct())
*/
public function ShowPage()
{
    $this->load->view($this->template_base.'/page', $this->content);
}

Just calling:

Code:
$this->template_set('frontpage_main', $data);

# Then

$this->template_set('navigation', '', 'navigation');

# Bottom of controller
$this->ShowPage();

Then in my template, echo'ing out the slice:

Code:
&lt;html&gt;
...
&lt;?php echo $navigation; ?&gt;
...
&lt;?php echo $content; ?&gt;
&lt;/html&gt;

But I'll check this out, looks interesting! Thanks!
#69

[eluser]ironlung[/eluser]
Is there a bug thread for Template Library?

I have been using it for quite a while with my mac as a server and loaded it up onto my webserver last night. Weird thing is I get a Safari cant open page because the server unexpectedly dropped the connection when I call it from 2 of my controllers and not the other 5.

I can delete everything in the controller except $this->template->render(); and it still blows out, I can write to templates its just the render method.... I cant get at the damned php error logs off of the server so I'm in a bit of a bind. Anyone had anything similar, could it be anything to do with the fact the server is a linux box and there is an error only occurs on linux in my code?

thanks in advance
#70

[eluser]Colin Williams[/eluser]
I haven't heard of that issue before, ironlung. Hopefully you can get your hands on the apache error logs soon and see what the issue is. I develop on a Windows box and run my sites on a Linux box and have never had any issues stemming from the Template class.

Quote:I can delete everything in the controller except $this->template->render();

Are individual controller functions not working, or entire controllers altogether? Could be something in the constructor? Something in routes? A naming convention issue?




Theme © iAndrew 2016 - Forum software by © MyBB