Ok. Solved the problem! I had to explicitly name the id-element! Using
the following code to create the link solved the problem:
$html->link(
'Artist 2',
array(
'controller' => 'artists',
'action' => 'view',
'id' => 2
)
)
On Apr 9, 9:31 am, ThunderTD <[email protected]> wrote:
> The language ($this->param['langauge']) ]is already set and I didn't
> explicitly specify it because I don't want it to change will going
> through the page.
>
> On Apr 8, 5:50 am, Ryan Schmidt <[email protected]> wrote:
>
>
>
>
>
>
>
> > On Apr 7, 2011, at 12:42, ThunderTD wrote:
>
> > > I configured my route similar to one example in the CakePHP Book. I
> > > want to reach the ArtistsController's view action via the URL
> > >http://xxx/artists/id. Everything is working fine with the following
> > > Routes entry and this direction:
>
> > > Router::connect('/:language/artists/:id',
> > > array('controller'=>'artists','action'=>'view'), array('pass' =>
> > > array('id'), 'language' => '[a-z]{3}','id' => '[0-9]{1}'));
>
> > > But what about the proper reverse lookup? If I use the HtmlHelper
> > > Function Link in the following way:
>
> > > $html->link('Artist 2', array( 'controller' => 'artists', 'action' =>
> > > 'view', 2 )) ,
>
> > > the link is resolved tohttp://xxx/artists/view/2insteadof the
> > > desiredhttp://xxx/artists/2.
>
> > > Is this the desired behavior?
>
> > It doesn't look like you specified the language in the $html->link
> > (properly: $this->Html->link) command, and your route does seem to rely on
> > the language being set. Did you mean to specify it there, or is it being
> > included by some other means that you didn't show?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php