The anatomy of a snippet call
Recently I came across to a nice wiki article "Snippet call anatomy" written by our Testing Team member, dev_cw. Be sure to check it out, especially the new users.
This one will also be helpful, Common snippet error messages and their meaning.
Comments
How do I set up a snippet parameter for a snippet call?
How do I get the output to return?
To answer your questions: The snippet parameters ¶m=`value` are reflected as variables to be used within the snippet. So if you have a parameter named &data this is available as a variable in your snippet as $data and can then be used by the snippet code.
The output can be generated basically the same way as with any php function. I use the return command, but others use echo.
Here is a basic example putting the two concepts together. Take this snippet call for example:
[ [mySnippet? &width=`100` &height=`300` ] ]
And here is the snippet:
<?php
$output = "The width is ".$width.", and the height is ".$height.".";
return $output;
?>
This will output: "The width is 100, and the height is 300."


Please login to comment.