• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View Modules in MVC

#1
[eluser]Ickes[/eluser]
Continuing my Noob education...

Example:
Have a blog module and a tutorial module.
For the sake of argument, I want the modules to appear in 3 ways.
1) A blog page that displays ONLY the blog module.
2) A tutorial page that displays ONLY the tutorial module.
3) An index page that displays the blog module & the tutorial module.

I can take care of 1 & 2 really easy. The _view for each looks something like this BUT in SEPARATE views:
Code:
//BLOG VIEW -> blog_view.php
<h2>&lt;?php echo $blog_title;?&gt;</h2>
<p>&lt;?php echo $blog_article;?&gt;</p>

//TUTORIAL VIEW -> tutorial_view.php
<h2>&lt;?php echo $tutorial_title;?&gt;</h2>
<p>&lt;?php echo $tutorial_article;?&gt;</p>

For #3, I can simply copy and paste that in one index_view.php. However, this gets complicated when I add more things such as author, email, date created, comments, etc. It also reuses a ton of code. So how is this normally done?

Before MVC, I would simply have a file named blog.php and tutorial.php. To accomplish #3, I would just php include them both. I assume there is an easy way to do so in MVC but I am struggling with the change in thought.

Any help is appreciated. Thanks.


Messages In This Thread
View Modules in MVC - by El Forum - 07-06-2009, 02:45 PM
View Modules in MVC - by El Forum - 07-06-2009, 02:54 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.