for search engines you can use canonical tag
but besides that your method looks pretty wrong to me
what if an invalid url is passed?
it should be more like
if (!id || !(record = findFirstById)) {
record = randomOne
}
On 16 Dez., 22:43, meinstream <[email protected]> wrote:
> Hi,
>
> looking for a way to show the Id in the url when calling a function
> that was not getting an id via get.
>
> Not giving an Id to the view function will trigger a random id that
> works fine like this:
>
> function view($id = null) {
> if ($id == null) {
> $random = $this->Movie->find('first', array(
> 'order' => 'rand()',
> ));
> $this->Movie->id = $random['Movie']['id'];
>
> } else {
> $this->Movie->id = $id;
> }
> $this->set('movie', $this->Movie->read());
> }
>
> Only I want the resulting Url to be :
> domain.com/controller/view/6
> and not:
> domain.com/controller/view/
>
> This could be important for search engines and facebook comments
> integration.
>
> Thanks for your help
--
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