Re: php, script.aculo.us and js serialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Im using Script.Aculo.Us' List Tree componente (javascript). After
> ordening the tree as the user wants to, the javascript returns this
> string:
> template[0]=1&template[0][0]=2&template[0][1]=3&template[0][1][0]=5&template[0][1][1]=7&template[0][1][2]=6&template[0][1][3]=8&template[0][2]=4
>
> If I use the explode function, i will get this:
> $arr[0] = 'template[0]=1'
> $arr[1] = 'template[0][0]=2'
> $arr[2] = 'template[0][1]=3'
> $arr[3] = 'template[0][1][0]=5'
> $arr[4] = 'template[0][1][1]=7'
> $arr[5] = 'template[0][1][2]=6'
> $arr[6] = 'template[0][1][3]=8'
> $arr[7] = 'template[0][2]=4'
>
> ....but i would rather have this as the result:
> $template[0]=1
> $template[0][0]=2
> $template[0][1]=3
> $template[0][1][0]=5
> $template[0][1][1]=7
> $template[0][1][2]=6
> $template[0][1][3]=8
> $template[0][2]=4
>
> Is it feasible?

you could do:
for ($i = 0; $i < count($arr); $i++) $arr[$i] = '$' . $arr[$i];
$line = implode("\n", $arr);
eval($line);

but is risky...

-- 
José Miguel Santibáñez
    jms@xxxxxxxxx


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux