Welcome Guest, Not a member yet? Register   Sign In
On having templates - a basic design question
#1

[eluser]MEM[/eluser]
Hello,

At this moment I have, on my controllers methods, something like:
Code:
$this->load->view('path/of/header.php', $someData);
$this->load->view('path/of/menu.php');
$this->load->view('path/of/methodSpecificViewCall.php', $someData);
$this->load->view('path/of/footer.php', $someData);

This is pure NO DRY and I realize that.
Coded like this, we can't pass the header, footer and menu calls that are common cross-pages, into the MY_Controller construct because we need to get this in given order.

So, I was thinking about doing something like this:

Have a template were we can load the common views.
On that template we have some placeholder that will be customized to fit a specific view.
That injection will be made on MY_Controller construct.

Question:
Does this makes any sense, can I have a push please?\


Thanks in advance,
MEM
#2

[eluser]techgnome[/eluser]
check out this posting... http://ellislab.com/forums/viewreply/810202/ it's a example of how I manage it.

-tg
#3

[eluser]MEM[/eluser]
Thanks a lot. Can you or anyone else point me a design pattern that could be used on this scenario?
#4

[eluser]WanWizard[/eluser]
Colin has good documentation on his website: http://williamsconcepts.com/ci/codeignit.../template/
#5

[eluser]MEM[/eluser]
Thanks. I'm still wondering if there is a design pattern that rules all this... Smile
But that will surely be the way to go. Smile




Theme © iAndrew 2016 - Forum software by © MyBB