Forum Moderators: coopster

Message Too Old, No Replies

MVC logic

         

nevski

7:22 pm on Mar 6, 2016 (gmt 0)

10+ Year Member



Hello guys,I'm building small MVC based blog(site) project,and I'm bit stuck with logic.My goal is to to get it right...

So,on normal no-MVC projects that I have done the structure of website looks like this.

---overallheader(which consists from header,logo,navigation,etc)
--- content
--- overall footer(sidebar,etc)

The logic of MVC is just to pass data to view that we got from model using controller.No such things as database queries in view(etc..).

And the thing is that I don't understand is how to make navigation in template.I must grab it in every controller and send it in view?Also with some related posts or something like that.These things are somewhat independent from content(on non-MVC project I just require prepared file like navigation.php ).And I would have to repeat the code a lot.Then I will break the rule don't repeat myself(DRY).

I didn't find any material on the internet that will explain how to tackle this issue.

Tnx in advance guys!

mipapage

10:29 am on Mar 14, 2016 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this is something you need to sort out based on your needs. How complex is the navigation? Will it be managed by the DB or entries somewhere?

As for the related entries, I've always treated that in the same manner as the overall idea of "mvc" (deliberate quotes there). Whatever calls the inclusion into the final view (control at some level) will have its model (get related posts based on some business logic) and view.