This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » View parameters multiple values for...
expandshrink

View parameters multiple values for one key

View parameters multiple values for one key

Wednesday 25 September 2013 12:33:29 pm - 1 reply

Is it possible to use view parameters in a std array fashion?

i.e.:

mymodule/(key1)/value1/(key1)/value2/(key1)/value3

Wednesday 25 September 2013 5:38:28 pm

function full_view_parameters(){
    $view_params = explode('(', $_SERVER['REQUEST_URI'], 2);
    if(count($view_params) > 0 ){
        $view_params = explode('/', '('.$view_params[1]);
        for( $i = 0 ; $i < count($view_params) ; ++$i ){
            $key = substr($view_params[$i], 1, -1);
            //check for value in next
            if( $view_params[$i+1] ){
                $value = $view_params[$i+1];
                ++$i;
            }
            if( !array_key_exists( $key, $return ) ){
                $return[$key] = array();
            }
            $return[$key][] = $value;
        }
    }
    return $return;
}

Modified on Thursday 26 September 2013 12:06:10 am by John Carmichael

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from