As I couldn't manage to make this hack working 'as is', I created a workaround to obtain the same results.
Here they are, if - as read - someone else got the same problems.
Add
PHP Code:
//HACK: Return to edit page after saving template
makeyesnocode("Return here","comeback",1);
makehiddencode("prevaction", "$action");
//HACK: Return to edit page after saving template
wherever you want to return to (I mean, right before the 'save changes' button in edit section)...
Later, in the 'doupdate' section, add at the end:
PHP Code:
//HACK: Return to edit page after saving template
if ($comeback and $prevaction) {
cpredirect("template.php?s=$session[sessionhash]&action=$prevaction&templateid=$templateid",0);
}
//HACK: Return to edit page after saving template
It should work...
Thanks to Chen for the idea.