views:

115

answers:

1

I'm developing a website for a client, in which they want to be able to manage content and add/remove pages.

At the same time, some pages on the site will be interactive and provide custom reports for logged-in customers.

I've started developing the site in ASP.NET MVC, because I wanted full control over rendering.

However, I'm finding it difficult to conceptually model the site.

If users can add/remove pages, then how can there be a direct mapping of URLs to controllers?

I could do a single 'Page' controller and pass it a content ID, but that would mean that all the code in the site would sit under 1 class file.

I could make the custom/interactive pages sit under different controllers, but then, how will the customer be able to manage them?

I'm really lost with the usability angle of this as well. If I'm building custom interactive pages, how can the client add/remove them anyway? Won't that be modifying the structure of the application itself?

+2  A: 

I'm having some problems understanding exactly what you're trying to get at with and what your problem is:

I could do a single 'Page' controller and pass it a content ID, but that would mean that all the code in the site would sit under 1 class file.

I could make the custom/interactive pages sit under different controllers, but then, how will the customer be able to manage them?

What's wrong with "a single class file"? Is your problem from a semantic perspective (ie, you don't want all URLs to begin with /pages)? Or just code management?

Assuming you're serving from a database, I would do the following:

  1. Have a CMSController that accepts requests. It either a) checks the ID (maybe disregarding a stub), or b) takes the stub and looks it up in the db.
  2. Return the content.

That way requests to /CMS/Page/4384 would be served up as you wish. You would then extend this in several ways. Put in a default action, so /CMS/4384 serves up the page. Then add a stub (/CMS/4384/Page-Title-Or-Whatever-Text). Set up additional routes such as /aboutus/ and /product_info/ to all point at your CMSController. Or just have a catchall point to the CMSController.

Also, the controller could open up an html file on the filesystem and serve that.

Does that help at all?

James

James S