Sunday, May 2, 2010

Re: Newbie problem with 15 minute blog in Cake 1.3

you can access it 

$this->params['named']['id']


your view action may take it as argument (in controller)
..
function view($id) {
...
}
..

----

You can alter posts routes should you want to use slugs rather than ids with Syrup.Sluggable  (syrup is a cake plugin that has a few behaviours)

- S



On 2 May 2010 23:27, Matt <mattlavinder@gmail.com> wrote:
> The controller has the 'params' property. If you output this:
> debug($this->params); //from your view
> I believe you should see your id showing in the 'pass' array if everything
> is working. If it's there, this will confirm the value is getting all the
> way in to your controller or not. If it's there, then to problem isn't in
> the mod-rewrite or anything early in the process.
>
> Don

Thanks for the tip.  Added the debug code and pasting the output
below.   ID is in the "named" element but not the "pass" element.  Is
that a problem?

Array
(
   [controller] => posts
   [action] => view
   [named] => Array
       (
           [id] => 3
       )

   [pass] => Array
       (
       )

   [plugin] =>
   [form] => Array
       (
       )

   [url] => Array
       (
           [url] => posts/view/id:3
       )

   [models] => Array
       (
           [0] => Post
       )

)

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: