Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-06 Thread WebbedIT
At the risk of being wrong again, how's the issue with 1.3?

The 1.3 tutorial rightly includes links to edit and delete blog posts
NOT using named parameters.  It's the 1.2 tutorial that wrongly, IMO,
uses named parameters even though in the view section of the tutorial
it clearly states to pass the id value as a passed parameter.

HTH

Paul

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


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-06 Thread JasonFX
I confirm that Matt isn't doing anything wrong. I am having the same
issue, I installed a fresh copy of cake and followed the tutorial but
stumbled on an error as described by Matt. The issue seems to be with
cake 1.3


On May 4, 4:01 am, WebbedIT  wrote:
> @Matt: When starting with CakePHP the main rule you should ALWAYS
> follow is stick to the conventions.  You have deviated from the
> tutorial by changing urls from the conventional format (explained
> within the tutorial onhttp://book.cakephp.org/view/336/Creating-Post-Views)
> of
>
> /controller/action/param1/param2
>
> to
>
> /controller/action/paramName1:paramValue1/paramName2:paramValue2
>
> and in doing so have caused yourself this issue.
>
> When learning a new framework it is tempting to try and stick to some
> of your own previous conventions, but I promise you with CakePHP it is
> much better to conform to the frameworks conventions as it saves you
> s much time :)
>
> HTH
>
> Paul
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-05 Thread WebbedIT
Well I stand corrected, sort of :)

Thanks to an email reply sent direct to me, by mistake, by JasonFX I
decided to look at the blog tutorial a little closer and whilst what I
say above is right on the page I supplied a link for, I was unaware
that further on in the tutorial when dealing with editing and deleting
the tutorial examples include the following links

link($post['Post']['title'],array('action'=>'view',
'id'=>$post['Post']['id']));?>

link('Edit', array('action'=>'edit', 'id'=>
$post['Post']['id']));?>

link('Delete', array('action' => 'delete', 'id' =>
$post['Post']['id']), null, 'Are you sure?' )?>

I assume this is an error as the previous page about views definitely
covers passing the id as an unnamed parameter to the controller action
and in the 1.3 tutorial (pointed out by JasonFX) the above links don't
use named parameters.

Have added comments to the pages of the 1.2 tutorial where I spotted
this:
http://book.cakephp.org/view/339/Deleting-Posts
http://book.cakephp.org/view/340/Editing-Posts

Paul

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


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-04 Thread WebbedIT
@Matt: When starting with CakePHP the main rule you should ALWAYS
follow is stick to the conventions.  You have deviated from the
tutorial by changing urls from the conventional format (explained
within the tutorial on http://book.cakephp.org/view/336/Creating-Post-Views)
of

/controller/action/param1/param2

to

/controller/action/paramName1:paramValue1/paramName2:paramValue2

and in doing so have caused yourself this issue.

When learning a new framework it is tempting to try and stick to some
of your own previous conventions, but I promise you with CakePHP it is
much better to conform to the frameworks conventions as it saves you
s much time :)

HTH

Paul

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


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-03 Thread calvin
http://yourapp/foos/bar/id:1/ will not work when Cake is expecting
http://yourapp/foos/bar/1

Cake doesn't know the name of your function variables (I don't even
think there's a way to determine that in PHP). So it wouldn't know
that the 'id' named param is supposed to be the first argument in
FoosController::bar($id, [$var2, $var3...]). If you want to use named
parameters, then you need to define a custom route and tell CakePHP to
pass the named parameters to the action and the order to pass them in.
Otherwise, you'll have to use $this->passedArgs['id'] in the action.

See the cookbook: http://book.cakephp.org/view/949/Passing-parameters-to-action

On May 2, 3:58 pm, Sam Sherlock  wrote:
> 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  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 sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-02 Thread Sam Sherlock
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  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+unsubscr...@googlegroups.comFor
>  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-02 Thread Matt
> 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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Newbie problem with 15 minute blog in Cake 1.3

2010-05-02 Thread Don Drake
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

On Sat, May 1, 2010 at 5:40 PM, Matt  wrote:

> Well, the release said "stable' but I am trying to figure out if it is
> me, my configuration or what.
>
> I am using Apache2 on Windows Vista and PHP 5.2.10.  I seem to have a
> possible mod_rewrite problem but I am not sure.   It is obvious that
> the ID portion of the URL is not being handled correctly for some
> reason (id:N).  When I go to view or delete, nothing happens because
> the ID is not passed.  I have checked and double checked.  I have
> followed the tutorial to the letter.
>
> Where do I look? Any suggestions?
>
> 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+unsubscr...@googlegroups.comFor
>  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Newbie problem with 15 minute blog in Cake 1.3

2010-05-02 Thread Matt
Well, the release said "stable' but I am trying to figure out if it is
me, my configuration or what.

I am using Apache2 on Windows Vista and PHP 5.2.10.  I seem to have a
possible mod_rewrite problem but I am not sure.   It is obvious that
the ID portion of the URL is not being handled correctly for some
reason (id:N).  When I go to view or delete, nothing happens because
the ID is not passed.  I have checked and double checked.  I have
followed the tutorial to the letter.

Where do I look? Any suggestions?

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