Re: Organizing hierarchical system with breadcrumb navigation

2009-08-28 Thread geste

Hi,

On Aug 27, 10:27 pm, Braindead markus.he...@gmail.com wrote:
 In my opinion using a model for breadcrumbs is bloated. Why don't you
 just set the breadcrumbs in the view manually? The HTML helper has two
 functions addCrumb and getCrumbs, which makes basic breadcrumbs really
 simple.

Well, I am using a menus model/controller/view to generate the menu,
so it is no big deal to set a viewVar to be used in the breadcrumb.  I
am using a Crumb Helper (http://bakery.cakephp.org/articles/view/
breadcrumb-helper) in the view like so:

   echo $crumb-getHtml($menuttitle, null, 'auto' ) ;

But maybe I should back up and look at the add/getCrumb in the HTML
helper.  I was thinking that if I stored menu links as fully-qualified
paths like /financial/budgets/index I could then split that path and
turn it in to Financial  Budgets  Index breadcrumb.

I guess the bigger question is whether to map something like /budgets/
action to /financial/budgets/action using routes.php.

Adn I guess a more general questions is what do people do if they want
to create a hierarchical application view when the default
organization of model/action is flat under the application root.

Thanks,

Jim

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Organizing hierarchical system with breadcrumb navigation

2009-08-27 Thread geste

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
-~--~~~~--~~--~--~---



Re: Organizing hierarchical system with breadcrumb navigation

2009-08-27 Thread Braindead

In my opinion using a model for breadcrumbs is bloated. Why don't you
just set the breadcrumbs in the view manually? The HTML helper has two
functions addCrumb and getCrumbs, which makes basic breadcrumbs really
simple.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---