I managed to modify the content but I have some problems with the cache.
The visitor chooses the type of display with a form and the content is modified by the TV. But if the page is in the cache, the content is not modified.
@EVAL
$myContentVar = $modx->documentObject['content'];
if(isset($_POST['disp_type']))
{
$_SESSION['disp_type'] = $_POST['disp_type'];
setcookie('disp_type', $_POST['disp_type'], time()+365*24*60*60, "/");
}
elseif(isset($_COOKIE['disp_type']))
{
$_SESSION['disp_type'] = $_COOKIE['disp_type'];
}
else
{
$_SESSION['disp_type'] = '';
}
switch($_SESSION['disp_type'])
{
case 'x' :
$char_disp = array('cx', 'cx', 'Cx', 'Cx}',
'gx', 'gx', 'Gx', 'Gx',
'hx', 'hx', 'Hx', 'Hx',
'jx', 'jx', 'Jx', 'Jx',
'sx', 'sx', 'Sx', 'Sx',
'ux', 'ux', 'Ux', 'Ux');
break;
case 'h' :
$char_disp = array('ch', 'ch', 'Ch', 'Ch}',
'gh', 'gh', 'Gh', 'Gh',
'hh', 'hh', 'Hh', 'Hh',
'jh', 'jh', 'Jh', 'Jh',
'sh', 'sh', 'Sh', 'Sh',
'uh', 'uh', 'Uh', 'Uh');
break;
case 'a' :
$char_disp = array("c'", "c'", "C'", "C'}",
"g'", "g'", "G'", "G'",
"h'", "h'", "H'", "H'",
"j'", "j'", "J'", "J'",
"s'", "s'", "S'", "S'",
"u'", "u'", "U'", "U'");
break;
case 'c' :
$char_disp = array('c^', 'c^', 'C^', 'C^}',
'g^', 'g^', 'G^', 'G^',
'h^', 'h^', 'H^', 'H^',
'j^', 'j^', 'J^', 'J^',
's^', 's^', 'S^', 'S^',
'u^', 'u^', 'U^', 'U^');
break;
default:
$char_disp = array('ĉ', 'ĉ', 'Ĉ', 'Ĉ}',
'ĝ', 'ĝ', 'Ĝ', 'Ĝ',
'ĥ', 'ĥ', 'Ĥ', 'Ĥ',
'ĵ', 'ĵ', 'Ĵ', 'Ĵ',
'ŝ', 'ŝ', 'Ŝ', 'Ŝ',
'ŭ', 'ŭ', 'Ŭ', 'Ŭ');
}
$char_src = array('cx', '{cx}', 'Cx', '{Cx}',
'gx', '{gx}', 'Gx', '{Gx}',
'hx', '{hx}', 'Hx', '{Hx}',
'jx', '{jx}', 'Jx', '{Jx}',
'sx', '{sx}', 'Sx', '{Sx}',
'ux', '{ux}', 'Ux', '{Ux}');
$myContentVar = str_replace($char_src, $char_disp, $myContentVar);
return $myContentVar;