I have modeled a business system for my department and it includes
about 60 tables/models, perhaps 20 of which as simply lookup/reference
tables that I would only make available through admin routing.
Out of the box, CakePHP organization is pretty flat -- views and
controllers all lying under the application root. So for example,
let's say I have these 6 models/controllers:
/budgets
/invoices
/expenses
/rooms
/buildings
/equipment
What I want to do is organize these more hierarchically, like so:
/financial
/budgets
/invoices
/expenses
/facilities
/rooms
/buildings
/equipment
I have created a model called menus that is structured to support a
2-level menu and the structure is like so (this is example of a top-
level menu entry):
[id] = 1
[parent_item] = 0
[title] = Financial
[menu_link] = /financial
[weight] = 20
I also found a breadcrumb helper that is fairly simple to add.
To support some of these top-level menus I have added entries in
routes.php, so that when you, for example, navigate to /financial it
actually maps to a show menu function in the menus controller that
takes /financial as a parameter amd then displays the child menu
items for financial.
Great. So now the issue that I am looking at is this: When you go
into Financial menu and click on budgets it goes to the budgets
controller/view that is sitting under the Web root as simply /
budgets (and for the moment simply using the default, baked view).
At that point my context for Back and breadcrumbs is lost.
So I am trying to think of the sanest, least onerous method to add
some hierarchical navigation into all of these various controllers and
the associated add/edit/index views.
I realized that I could add a lot of this in routes.php, for example I
could map /financial/budgets to /budgets so that the URL would
show the hierarchy (and I could also write a function to split the
link into breadcrumb components (Financial Budgets). But keeping
eveything up in routes.php seems a little abusive of what routes.php
is supposed to do. I am curious to know if anyone has any other
ideas.
To make this more complicated, I'll be using Authake to enforce access
control. So, for example, some users may not have any access to some
of the top-level menus (like Financial, say). So I want to try to
keep this simple enough to be able to apply reasonably simple access
rules.*
Thanks,
Jim
*This brings a question to mind: if using a route, does access control
test against the route or against the controller you are routing to?
I'm guessing the latter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---