tags:

views:

345

answers:

2

I have made a tiny ModX snippet that looks like this

<?php
$theMenu = $modx->runSnippet('Wayfinder',
 array("startId" => 0, "level"=>1)
);
echo $theMenu;
?>

but I would like it to pass ALL params it receives to Wayfinder. I will only be modifying the "level" parameter from my snippet.

Is there any way, without naming all the relevant variables individually, to cycle through all the currently SET variables in PHP?

Edit: I don't think that get_defined_vars is the right way to go, as it gets too much stuff. This trivial PHP page prints out the number 14, for instance:

<?php
echo count(get_defined_vars()); 
?>
+1  A: 

This might be useful: get_defined_vars() ?

Edit

From http://bobsguides.com/modx-snippet-faq.html:

You can also access the parameters via the associative array $modx->event->params.

Tom Haigh
+1 thanks for that, modified the question to include your answer
Yar
A: 

try using foreach to auto assign parameters to wayfinder object

Aramaki