Saturday, December 31, 2011

Re: get current url as array

You should be able to get the data you need in $this->params.

Mike Karthauser
Brightstorm limited
Tel: 07939252144

On 31 Dec 2011, at 12:01, euromark <dereuromark@googlemail.com> wrote:

> any feedback?
> seems like this is a missing functionality.
>
> example:
> admin/authplugin/users/edit/2
>
> I would expect to find some router method to get
>
> $url = array(
> 'admin' => 1
> 'plugin' => 'authplugin'
> 'controller' => 'users'
> 'action' => 'edit'
> 2
> )
> for example
> maybe with Router::urlAsArray()
> which would be similar to the result of Router::parse() but it already
> contains the passed and named params as expected
> to easily adjust it before passing it to Html::url() or Html::link():
>
> $url[#] = 'somehash';
> or
> $url[] = 'somepassedparam';
> or
> $url['key'] = 'somenamedparam';
>
> echo $this->Html->link('Title', $url);
>
>
>
>
> On 28 Dez., 21:59, euromark <dereurom...@googlemail.com> wrote:
>> ...or for any url for that matter (for adding some named/pass params
>> etc)
>>
>> PS: I forgot
>> if (isset($urlParams['prefix'])) {
>> unset($urlParams['prefix']);
>> }
>>
>> On 28 Dez., 21:04, euromark <dereurom...@googlemail.com> wrote:
>>
>>
>>
>>
>>
>>
>>
>>> am I missing sth or is there no url() method etc for returning the
>>> current url as array?
>>> I only know this way:
>>
>>> $urlParams = Router::getParams(true);
>>> $urlParams = am($urlParams, $urlParams['named'],
>>> $urlParams['pass']);
>>> unset($urlParams['named']);
>>> unset($urlParams['pass']);
>>
>>> but it seems a little bit like overhead...
>>> does anyone know how to do that easier?
>>> maybe we should introduce Router::urlAsArray()
>>> with default NULL => return current ?
>
> --
> 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
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
>

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate