Welcome Guest, Not a member yet? Register   Sign In
View system for CodeIgniter {beta}
#6

[eluser]almightyolive[/eluser]
[quote author="rxhector" date="1345849915"]I have a 'hello world' that does almost the same thing - i just load one layout and then make the layout call the little views (elements) - take a look - this2.is-slick.com[/quote]

Yeah, pretty much the same thing! And I came to the same conclusion with what you said in Chapter 3; CodeIgniter allows way too much View code in the Controller.

The biggest difference between my code and your code (that I can see) is that I try and do away with the controller ever having to call
Code:
$this->load->view('template');

I do this by creating a Post-Controller hook that runs my View library's display() function. The display() function will then try to load the appropriate template and view (either through configuration or convention) and then parse the result.

The way I parse it is similar to Ocular (https://github.com/lonnieezell/Ocular-Template-Library). I freely admit that I borrowed heavily from this library and added my language customisations and the addition of 'Modules'.

For example if you had a welcome controller with the index function, the display() function will load up a template (based on router directory, controller or system default) and then a 'view instance' which matches the function. In this case, it will try to load up a view file named as ./application/views/welcome/index.php

Finally, it will glue these files together and another other values you have parsed through (as well as modules).


Messages In This Thread
View system for CodeIgniter {beta} - by El Forum - 08-16-2012, 01:23 PM
View system for CodeIgniter {beta} - by El Forum - 08-16-2012, 01:36 PM
View system for CodeIgniter {beta} - by El Forum - 08-17-2012, 06:01 AM
View system for CodeIgniter {beta} - by El Forum - 08-24-2012, 02:00 PM
View system for CodeIgniter {beta} - by El Forum - 08-24-2012, 04:11 PM
View system for CodeIgniter {beta} - by El Forum - 08-26-2012, 10:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB