Path

ez projects / owviewparams


OWViewParams

UNIX name Owner Status Version Compatible with
owviewparams Simon Boyer stable 1.3 4.x
owViewParameters is a template operator which help you to manage url and view_parameters.

owViewParams template operator generates a new url with all view_parameters you want to preserve, modify, and remove.

Example :

You have this url :

http://domain.com/request/(param1)/value1/(param2)/value2

And you want modify the param1 value, remove param2 and add a new parameter, you can use owViewParams operator :

<a href="{'http://domain.com/request'|createUrl( $view_parameters,
                    hash('modify', hash('param1', 'newValue1',
                                           'param3', 'value3'),
                          'exclude', array( 'param2')
                      ) )}">Test</a>

This will return :

http://domain.com/request/(param1)/new_value1/(param3)/value3

Parameters :

'modify' : used to modify view_parameters values. If a view_parameter doesn't exists, it will be created.
'only' : used to keep only specified view_parameters (added to 'modify' view_parameters)
'exclude' : used to remove specified view_parameters (except 'modify' view_parameters)
  
---------------------------------------------
Hope you find it useful!
Simon Boyer

No news yet.

This project has no reviews yet. Be the first one to review it!

No forum messages yet.