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

[eluser]ironlung[/eluser]
Quote:I can delete everything in the controller except $this->template->render();

Hey Colin

I thought I had already replied and cleared the issue, I am sorry. You are correct it was a naming convention issue, I had a function called view in those 2 controllers, I renamed those functions to display and all is now fine and dandy.

Thanks for your support

Iron
#72

[eluser]RJ[/eluser]
Hello,

Having an issue with the write_view() method not working properly, below is my implimentation.

The write() method appears to work as expected.

Code:
// set nav
$nav = "all kinds of cool stuff";

// write to $title
$this->template->write('title', 'Welcome FindWhere White Label');
            
// write to $nav
$this->template->write_view('nav', 'template', $nav, TRUE);

// render page
$this->template->render();

echo region in template:
Code:
<?php echo $nav; ?>

Any thoughts why my write_view is not working? I simple get an error that $nav is an undefinied variable.

Thank you

Quote:Figured out the problem, $data['nav'] = "nav content"; then pass $data.
#73

[eluser]Unknown[/eluser]
Colin,

I recently downloaded your library for use in an e-commerce site I am working on and I have to say, excellent job.

This has really allowed me to clean up my codebase and have my view logic so much cleaner.
#74

[eluser]Chris Williams[/eluser]
Is there a way to cache pages through this library?
#75

[eluser]Colin Williams[/eluser]
@david Sparkman: Thanks

@chris Williams: The class does no cache handling of its own. It also does not get in the way of CI's caching.
#76

[eluser]Junior_Coder[/eluser]
Good job... Wink
#77

[eluser]Junior_Coder[/eluser]
Colin,

I recently downloaded your library for use in an e-commerce site I am working on and I have to say, excellent job.

This has really allowed me to clean up my codebase and have my view logic so much cleaner.
#78

[eluser]koryrok[/eluser]
Hello,

Please see snippet from docs below:

Code:
[...] so the write_view() method lets you suggest other View files to load if the defualt View file you passed in the first argument doesn't exist. [...]

I don't understand what you mean by "doesn't exist" what default view are you referring to? As Im understanding it, the default views are physical files located in the views folder so Im not sure how they could (or would) not exist.

Thanks,
Kory
#79

[eluser]Chris Williams[/eluser]
[quote author="Colin Williams" date="1239505569"]
@chris Williams: The class does no cache handling of its own. It also does not get in the way of CI's caching.[/quote]

Just to clarify, are you saying I can use it with CI's caching just as I would with a typical View?
#80

[eluser]Colin Williams[/eluser]
Quote:I don’t understand what you mean by “doesn’t exist”

Well, if the view file doesn't exist on the file system, Template tries the next one. Consider this use:

Code:
$post = $this->blog_model->get($id);
$this->template->write_view('content', 'blog/post-'. $id, compact($post), 'blog/post';

This means Template will fallback to the blog/post.php view. But, if you wanted to specially format a specific blog post, you could create a file called 'blog/post-23.php' and since that was your initial suggestion, it will automagically be used.

Quote:Just to clarify, are you saying I can use it with CI’s caching just as I would with a typical View?

Right. CI's caching is tied to the Output class. Template only interfaces with Views via the Loader class. So it does not interfere with CI's regular caching. If you were going to implement views-level partial caching, I would recommend overloading the Loader class. If you wanted to implement region-level partial caching (perhaps and interesting idea), then you would want to modify or overload the Template class.




Theme © iAndrew 2016 - Forum software by © MyBB