Welcome Guest, Not a member yet? Register   Sign In
Template Library Version 1.4

[eluser]AgentPhoenix[/eluser]
The example you give makes it sound like you're trying to call a variable in your view file that triggers a second view being written, but if you haven't defined that variable, then you'd be getting that error. Your best bet is probably to parse the subregion content in your controller and append it to the end of your main content region.

Code:
$data['subregion'] = $this->parser->parse('subregion_view_file', $subdata, TRUE);

From there, you could just pass $data to your view like normal, but in your view file, echo out $subregion wherever you want it. If you're using a single view file, you can even create a check to see if the variable exists and then echo it out. I think that'll be the easiest way of doing it without adding the subregion to the Template config file, though Colin may have more insight and better ways of doing things.

[eluser]pnd_ku[/eluser]
[quote author="AgentPhoenix" date="1254331170"]The example you give makes it sound like you're trying to call a variable in your view file that triggers a second view being written, but if you haven't defined that variable, then you'd be getting that error. Your best bet is probably to parse the subregion content in your controller and append it to the end of your main content region.

Code:
$data['subregion'] = $this->parser->parse('subregion_view_file', $subdata, TRUE);

From there, you could just pass $data to your view like normal, but in your view file, echo out $subregion wherever you want it. If you're using a single view file, you can even create a check to see if the variable exists and then echo it out. I think that'll be the easiest way of doing it without adding the subregion to the Template config file, though Colin may have more insight and better ways of doing things.[/quote]

Thank you a lot! Smile
I was thinking about similar solution.
Template lib can render view at variable too (help as avoid separate parser class) and then we can pass it to subregion.
In this way i can`t see a lot of advantages before usual $this->load->view Sad
And i wuzz thinking about totally transparent solution using Template lib - dynamically adding of region and filling it with some content from another view.

Let`s wait for response of the author Smile And thank you once again!

[eluser]Tim Brownlaw[/eluser]
Hi Colin,
Just to let you know, I finally came to the grand conclusion that I needed a Class to handle my templating.
The way I was doing it was getting a lil out of hand and wasn't the right way to do it - although it worked.

So I bit the bullet and came a looking, found your library and gave it a shot.
It does everything I was cludging in a much tidier and smarter way and it was where I was heading but you've already done all the hard work.

It works a treat and I'm very impressed, so that's one major hurdle overcome from now on.

If you ever get over to Melbourne, Australia, I'll have to buy you a cold one!

Cheers
Tim

[eluser]dannieWalden[/eluser]
Hey gurus.

I just started using the template library. i've followed the userguide several times to get i right, but i get following error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Page::$parser

Filename: libraries/Template.php

Line Number: 574

Cant find out why?

Can anyone help me, please Smile

[eluser]WanWizard[/eluser]
You haven't defined 'parser' and 'parser_method' in the configuration of the template, but either 'parse_template' is set to TRUE, or you've called the render() method with the third parameter set to TRUE.

[eluser]dannieWalden[/eluser]
thiught i read it to be set to CI's parser by default?

[eluser]WanWizard[/eluser]
Yes, it is.

But looking through the code, the set_parser() method is responsible for loading the parser library (whatever parser you define). And this method is only called from initialize(), which in turn is called by set_template().

So if you call set_template() to load your template config, and 'parser' is not part of the template config, the parser library will not be loaded, and you get this error.

[eluser]dannieWalden[/eluser]
THanks mate. Youre the man Smile

Have a nice christmas Smile

[eluser]Ray Nara[/eluser]
problem with modular extension,
how do use with modular extension




Theme © iAndrew 2016 - Forum software by © MyBB