This is what I'm using:
Router::connect(
'/posts/tags/:tag_slug',
array('controller' => 'posts', 'action' => 'tag'),
array(
'pass' => array('tag_slug'),
'tag_slug' => '[-_A-Za-z0-9]+'
)
);
public function tag($tag_slug)
{
$posts = $this->Post->find(
'matches',
array(
'model' => 'Tag',
'scope' => array('Tag.slug' => $tag_slug),
'fields' => $this->paginate['fields'],
'contain' => $this->paginate['contain'],
'order' => $this->paginate['order']
)
);
...
Note that I'm just re-using some of my $paginate options. The
'matches' part is courtesy of Nate:
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find
On Mon, May 25, 2009 at 4:31 PM, Dave <[email protected]> wrote:
>
> I have Posts which HABTM Tags.
> Tags are controlled by site admin so users creating a Post can only
> select Tags created by the site admins. How when viewing the Posts
> standard baked index pagination page can a user select all Posts
> tagged with one of the Tags options?
>
> So if a Post was created selecting the Tag option "Environmental" how
> would a user view all Posts tagged with Environmental?
>
> Thanks
>
> Dave
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---