I'm thinking the same thing as you, currently, I'm using it in a
project that uses a tree behavior to display it's content. So I like
to display the parent of the page before the page itself in the
breadcrumbs. To do this, I had to create a function into my view that
would populate the breadcrumb. But I really don't like this approach,
it's a relatively important function into a view, what the hell?
I would prefer to do this as you said, from within a controller, would
find this more MVC oriented.
Here's an exemple of the code I've made for a paginated content,
supposed recursive is set to 2 (which belongs to the controller):
the call :
populate_breadCrumb($this->params['named']['page']-1, $tutoriels,
$html, $this->pageTitle);
the function :
function populate_breadCrumb($params, &$data, &$html, $pageTitle =
null){
if(!empty($data[$params]['Tutoriel']['title'])){
if(!empty($data[$params]['Parent']['id'])){
foreach($data as $k => $tuto){
if($data[$params]['Parent']['id'] ==
$tuto['Tutoriel']['id']){
$new_param = $k;
populate_breadCrumb($new_param, $data,
$html);
break;
}
}
}
if(!empty($data[$params]['Parent']['title'])){
if($pageTitle == $data[$params]['Tutoriel']['title']){
$link = null;
}else{
$link = '/view/page:'.($params+1);
}
$html->addCrumb($data[$params]['Tutoriel']['title'],
$link);
}
}
}
Maybe a better way around would be to create view variable, but.. but?
Or to create a helper.. anyway, some work is necessary around this
functionnality I think. Or I didn't understood the logic behind
either ;)
On 2 avr, 19:40, aranworld <[EMAIL PROTECTED]> wrote:
> It seems most logical to me that I would want to use addCrumb() from
> within the controller -- maybe even a standard piece of overridable
> logic within the app_controller ... and then use getCrumbs() from
> within the view.
>
> Or, is this logic wrong?
>
> If you are using the HTML helper's crumb functionality, how are you
> using it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---