Tuesday, 10 September 2013

Asking advice for MVC page

Asking advice for MVC page

I would like to ask for some tips, on how solve this problem. I'm trying
to build my own MVC website. I learned the basics of the URL.
http://mysite.com/blog/cosplay/cosplayer-expo-today
blog -> the controller
cosplay -> the method in controller
cosplayer-expo-today ->variable in method
What if i dynamically extend the category in my blog controller? Will I
need to create the method, or is there some trick to do that
automatically? I mean... i have these categories now:
cosplay,game,movie,series. So I need to create these methods in
controller, but they all do the same thing, namely select other category
from database.
function cosplay() = mysite.com/blog/cosplay/
function game() = mysite.com/blog/game/
function movie() = mysite.com/blog/movie/
function series() = mysite.com/blog/series/
Is there any good advice on how can i write my controller to do that
automatically? I mean if I upload a new category in my database, but i
don't want to modify the controller. Is it possible? Thanks for the help!

No comments:

Post a Comment