简体   繁体   中英

Wrapping Wayfinder Menu in Modx: How to pass all vars (general PHP question, perhaps)

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()); 
?>

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.

尝试使用foreach自动将参数分配给Wayfinder对象

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM