Hello,
I don`t understand the way how to control the output of chunks via snippet.
For example: my snippet validates the input of a form and sets the value of $error = 1;
In this case I want my Resource to display (in addition to the normal content) 2 different Chunks: $fehler and $solution.
How and where do I have to pass the value of $error to create the desired output?
Many thanks in advance,
Inka
Quote from: Inka27 at Oct 20, 2010, 05:13 AM
Hello,
I don`t understand the way how to control the output of chunks via snippet.
For example: my snippet validates the input of a form and sets the value of $error = 1;
In this case I want my Resource to display (in addition to the normal content) 2 different Chunks: $fehler and $solution.
How and where do I have to pass the value of $error to create the desired output?
Many thanks in advance,
Inka
This might (or might not) be what you want:
<?php
/* Validate form here and set $form_error to true or false */
$output = '';
if ($form_error) {
$output .= $modx->getChunk('fehler');
$output .= $modx->getChunk('solution');
}
return $output;
FWIW, I would not use $error as a variable name.
It´s so easy! Works fine - thank you very much!
Glad it worked.