Thank you all very much, the code’s now working and I gained necessary knowledge to move forward with my edits. One thing concerns me though, I can’t seem to assign block to a template. Now i have:
Code: Select all
$a = $request->variable('a', ' ');
$b = $request->variable('b', 0);
if ($request->is_set_post('submit'))
{
if ($a == 'something')
{
$result = 'The A is '. $a .' and '. $b .' is the B';
}
}
$template->assign_block_vars('somename', array(
'RESULT' => $result,
));
var_dump ($result);
The template is just a table with very simple form:
Code: Select all
<table>
<tr>
<td>
A:
</td>
<td>
<select name="a">
<option value="something">something</option>
</select>
</td>
</tr>
<tr>
<td>
B:
</td>
<td>
<input type="text" name="b">
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Get a result">
</td>
</tr>
<tr>
<td>
Result is:
<li>
{somename.RESULT}
</li>
</td>
</tr>
</table>
„var_dump ($result);” gives me the correct values but nothing shows in the template where „{somename.RESULT}” is. I tried to move „$template->assign_block_vars” inside of my IF with no avail.