easiest/fastest way, use implode/explode
$string = implode('|', array('1', '2'....));
$array = explode('|');
if you really want to pass an array, do it like this:
http://example.com/mycontroller/myaction/?param[]=value1¶m[]=value2&...
and use the php $_REQUEST/$_GET or should also be visible in $this-
>params
On Sep 8, 7:59 am, Divya <[email protected]> wrote:
> Try this one: array_merge(array(
> 'controller'=>'users',
> 'action'=>'collection',
> $param['username'],
> $param['page']),
> $params['sort'],
> $params['direction']
> )
>
> On Sep 7, 8:55 pm, "Mariano C." <[email protected]> wrote:
>
> > Suggestions?
>
> > On 7 Set, 09:27, "Mariano C." <[email protected]> wrote:
>
> > > array_merge() returns me another array, so I really don't understand
> > > how I should use it.
>
> > > On 6 Set, 18:49, "j.blotus" <[email protected]> wrote:
>
> > > > array_merge()
>
> > > > On Sep 6, 12:15 pm, "Mariano C." <[email protected]> wrote:
>
> > > > > Can I resolve serializing the array()?
> > > > > And if I could how should I code the things?
>
> > > > > On 6 Set, 18:12, euromark <[email protected]> wrote:
>
> > > > > > you cannot put another array into the url array
>
> > > > > > On 6 Sep., 17:52, "Mariano C." <[email protected]> wrote:
>
> > > > > > > This is the error (line 121 in users_controller.php is "));" that
> > > > > > > closed redirect() function inside removeFromCollection()).
>
> > > > > > > Array to string conversion [CORE/cake/libs/router.php, line 1556]
> > > > > > > Context:
> > > > > > > $params = array(
> > > > > > > "controller" => "users",
> > > > > > > "action" => "collection",
> > > > > > > "plugin" => null,
> > > > > > > "pass" => array(
> > > > > > > "admin",
> > > > > > > "1",
> > > > > > > array(),
> > > > > > > array()
> > > > > > > ),
> > > > > > > "named" => array()
> > > > > > > )
>
> > > > > > > Code:
> > > > > > > Debugger::handleError() - CORE/cake/libs/debugger.php, line 306
> > > > > > > implode - [internal], line ??
> > > > > > > CakeRoute::_writeUrl() - CORE/cake/libs/router.php, line 1556
> > > > > > > CakeRoute::match() - CORE/cake/libs/router.php, line 1538
> > > > > > > Router::url() - CORE/cake/libs/router.php, line 838
> > > > > > > RequestHandlerComponent::beforeRedirect() -
> > > > > > > CORE/cake/libs/controller/
> > > > > > > components/request_handler.php, line 274
> > > > > > > Component::beforeRedirect() -
> > > > > > > CORE/cake/libs/controller/component.php,
> > > > > > > line 143
> > > > > > > Controller::redirect() - CORE/cake/libs/controller/controller.php,
> > > > > > > line 682
> > > > > > > UsersController::removeFromCollection() - APP/controllers/
> > > > > > > users_controller.php, line 121
> > > > > > > Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204
> > > > > > > Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171
> > > > > > > [main] - APP/webroot/index.php, line 83
>
> > > > > > > On 6 Set, 05:37, "j.blotus" <[email protected]> wrote:
>
> > > > > > > > No array to string conversion errors? What kind of E_NOTICE
> > > > > > > > error are
> > > > > > > > you getting.
>
> > > > > > > > On Sep 5, 3:27 pm, "Mariano C." <[email protected]>
> > > > > > > > wrote:
>
> > > > > > > > > I haven't error message, line 106 and 107 are just the line of
> > > > > > > > > collection() function with debug instructions.
>
> > > > > > > > > On 5 Set, 21:04, "j.blotus" <[email protected]> wrote:
>
> > > > > > > > > > what is the specific error message you are getting. check
> > > > > > > > > > lines 106
> > > > > > > > > > and 107 of your users_controller.php
>
> > > > > > > > > > On Sep 5, 12:38 pm, "Mariano C."
> > > > > > > > > > <[email protected]> wrote:
>
> > > > > > > > > > > Then I've a method called collection
>
> > > > > > > > > > > function collection($username = null,
> > > > > > > > > > > $page = 1,
> > > > > > > > > > > $sort = array('Artist.name',
> > > > > > > > > > > 'Album.year'),
> > > > > > > > > > > $direction = array('ASC',
> > > > > > > > > > > 'ASC')
> > > > > > > > > > > )
> > > > > > > > > > > {
> > > > > > > > > > > debug(is_array($sort));
> > > > > > > > > > > debug($sort);
>
> > > > > > > > > > > }
>
> > > > > > > > > > > it's fully working, matter of fact:
> > > > > > > > > > > app/controllers/users_controller.php (line 106)
> > > > > > > > > > > 1
>
> > > > > > > > > > > app/controllers/users_controller.php (line 107)
> > > > > > > > > > > Array
> > > > > > > > > > > (
> > > > > > > > > > > [0] => Artist.name
> > > > > > > > > > > [1] => Album.year
> > > > > > > > > > > )
>
> > > > > > > > > > > Now I've remove() function, something like that:
> > > > > > > > > > > function removeFromCollection($album_user_id = null)
> > > > > > > > > > > {
> > > > > > > > > > > $this->redirect(array(
> > > > > > > > > > > 'controller'=>'users',
> > > > > > > > > > > 'action'=>'collection',
> > > > > > > > > > > $param['username'],
> > > > > > > > > > > $param['page'],
> > > > > > > > > > > array('Album.year',
> > > > > > > > > > > 'Artist.name'),
> > > > > > > > > > > array('ASC', 'ASC')
> > > > > > > > > > > ));
>
> > > > > > > > > > > }
>
> > > > > > > > > > > but when I call removeFromCollection() and redirect to
> > > > > > > > > > > collection is
> > > > > > > > > > > performed debug() output is:
> > > > > > > > > > > app/controllers/users_controller.php (line 106)
>
> > > > > > > > > > > app/controllers/users_controller.php (line 107)
> > > > > > > > > > > Array
>
> > > > > > > > > > > How can resolve this issue? How can I send array of
> > > > > > > > > > > element as
> > > > > > > > > > > parameter?
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en