Thanks, Jon, that's perfect.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Jon Bennett
Sent: 14 January 2010 15:07
To: [email protected]
Subject: Re: create a link with conditions to filter index action

hi Ben,

Used named parameters:

$html->link($category_name, array(
        'controller'=>'Blogs',
        'action'=>'index',
        'category_id'=>3,
        'tag_id'=>4
));

public function index()
{
        extract($this->params['named']);
        
        $conditions = array();
        
        if (isset($category_id))
                $conditions['Blog']['category_id'] = $category_id;
                
        if (isset($tag_id))
                $conditions['Blog']['tag_id'] = $tag_id;
                
        // etc
}

hth

Jon


-- 
jon bennett - www.jben.net - blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to