From Documentation
Quote
runSnippet($snippetName, $params=array())
// returns the processed results of a snippet to the caller
// $snippetName = name of the snippet to process
// $params = array of $key=>$value parameter pairs passed to the snippet
// returns the processed results of a snippet to the caller
// $snippetName = name of the snippet to process
// $params = array of $key=>$value parameter pairs passed to the snippet
The example below is querying the ListMenu snippett and sending a few variables to it using the runSnippet function.
// set the variables I am sending to snippett
$LM_node=28;
$LM_levelsDeep=-1;
// make them into an array
$params=compact('LM_node','LM_levelsDeep');
// run the snippett ListMenu and return processed contents to $output.
$output .= $etomite->runSnippet('ListMenu', $params);
// return output
return $output;There is no error checking in this example. If the called snippet fails I don't know if this will return false or just fail completely. When I called a script that didn't exist I believe the function returned false.
Paul.
PS I would hate to test it, but what happens if runsnippet is used to call the snippet containing runsnippet. Presuming a logical loop was used so it wasnt an infinite loop, how many levels deep could it deal with?
This post has been edited by PaulD: 17 February 2009 - 04:33 AM


Help

Back to top
MultiQuote








