0

I have a special need. I have an application with five modules:-

  1. Membership
  2. Rental
  3. Administration
  4. Accounting
  5. Reports

I am developing the application using MVC. I would like to have different type of Routing for this application as follows:-

/Module/Page/Action

Examples are:-

/Membership
/Membership/Home/
/Accounting
/Accounting/Home/
/Membership/Membership/Edit/1
/Accounting/JournalVoucher/Delete/1

etc.

Please note, that the Home page is repeated for every module.

I nearly have around 70 screens in my application. Can you please tell me what is the best way to achieve this goal.

tereško
  • 58,060
  • 25
  • 98
  • 150
iShah
  • 119
  • 2
  • 14

1 Answers1

0

I do not see any complication here. Since you didnt mention any language or framework that you are using, lets say you are using PHP/CodeIgniter.

/Membership
/Membership/Home/
/Accounting
/Accounting/Home/
/Membership/Membership/Edit/1
/Accounting/JournalVoucher/Delete/1

To handle these URLs, you simply create 2 controllers -

membership_controller
function Home

accounting_controller
function home
function membership($action, $param)
function journalvoucher($action, $param)

Regarding the structure you mentioned -

/Module/Page/Action

For every module, create a controller. For every page, create a function. Pass the actions as parameters to the function.

In case you have a variable number of parameters, then let the second parameter be an array.

tereško
  • 58,060
  • 25
  • 98
  • 150
pyrometer
  • 890
  • 1
  • 8
  • 17
  • .. or maybe you could assume, that he/she is not using a framework , which uses a mis-implemented MVC as marketing pitch. – tereško Jul 14 '12 at 00:01
  • mis-implemented MVC ? I'd call it flexibility and thats what I love most about CI :-) But yes I agree, I should have picked a stricter MVC as an example in the answer ! – pyrometer Jul 14 '12 at 00:12
  • Well .. any framework which points you to an ORM instance and say: *"see, this is model"* is a pile of dren. I kinda have [strong opinions](http://stackoverflow.com/a/5864000/727208) about mvc. – tereško Jul 14 '12 at 00:19