medoix
medoix

Reputation: 1179

Pass variable to CakePHP Helper inside the options array

This is setting a bread crumb but could be used on any helper i assume. I am trying to link to the current article that i am viewing in the bread crumb but not sure how to add the post ID after the view/ URL as i do with the news title before it?

$this->Html->addCrumb($news['News']['title'], array('controller' => 'news', 'action' => 'view/'$news['News']['id']));

Upvotes: 0

Views: 440

Answers (2)

Alvaro
Alvaro

Reputation: 41605

I usually prefer the CakePHP format to do it :)

$this->Html->addCrumb(
    $news['News']['title'], array(
        'controller' => 'news', 
        'action' => 'view',
         $news['News']['id']
    )
);

Upvotes: 2

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100205

You mean:

$this->Html->addCrumb(
    $news['News']['title'], array(
        'controller' => 'news', 
        'action' => 'view/' . $news['News']['id']
    )
);

Upvotes: 1

Related Questions