What would be the best approach for this case:
On the homepage there are two columns - events and news, the titles are pulled from a db. When you click on one or the other it takes you to a new page to view the full content pulled from the db.
I only want one page the view both news and events.
What is the best way for, lets say, view.php to determine the difference between the two db tables (news, events)?
What is the best way to view...
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
It sounds like if you had a single "full" view, you could just pass a different model to that view depending on what you wanted to display. The model could provide the page title, and rows of data. Probably you want the model to have getTitles() and getAllContent() methods for use on the home and "full" view pages respectively.
(#10850)
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
I was thinking that there would be two Models -- NewsModel and EventsModel. They would be polymorphic. You would decide which one to use based on some parameter (like your id=2). This show how web apps often fall into the MVC pattern. You have the Models that provide the data. You have the View that creates HTML with the data in it. And the Controller figures out which Model and View to use base on some parameters.
(#10850)
How do people get clean URLs using the method? Instead of http://www.mysite.com/view.php?id=324 I would get http://www.mysite.com/view.php/name-of-article/
Or is that a whole other topic?
Thanks for all you help, everything is much more clear now.
Or is that a whole other topic?
Thanks for all you help, everything is much more clear now.
Search for mod_rewritepsurrena wrote:How do people get clean URLs using the method? Instead of http://www.mysite.com/view.php?id=324 I would get http://www.mysite.com/view.php/name-of-article/
Or is that a whole other topic?
Thanks for all you help, everything is much more clear now.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
$_SERVER['PATH_INFO']psurrena wrote:How do people get clean URLs using the method? Instead of http://www.mysite.com/view.php?id=324 I would get http://www.mysite.com/view.php/name-of-article/
Yes it is.psurrena wrote:Or is that a whole other topic?
(#10850)