&$modx->documentObject[’content’];I used with the 096
Always in the hope of understanding the philosophy of Revolution , I try to convert my old plugin "footnote" but I don’t find (maybe because I don’t know where to look at) the equivalent of&$modx->documentObject[’content’];I used with the 096
$resource = $modx->getObject('modDocument',$modx->resourceIdentifier); echo $resource->content;
<?php $e = &$modx->Event; switch ($e->name) { case "OnLoadWebDocument": $o = &$modx->documentObject['content']; $npp = "jkjkjk"; $o .= $npp; break; default : return; break; } ?>
here the plugin should had the string "jkjkjk" at the end of the content ... how can I do that with Revolution ?Hi laurentc, just tried that sample plugin in my local install of Revolution and it works as intended - are you having issues with the above code?
here the plugin should had the string "jkjkjk" at the end of the content ... how can I do that with Revolution ?Hi laurentc, just tried that sample plugin in my local install of Revolution and it works as intended - are you having issues with the above code?
<?php switch ($modx->event->name) { case "OnLoadWebDocument": $modx->resource->content .= 'jkjkjk'; break; default: break; } ?>
here the plugin should had the string "jkjkjk" at the end of the content ... how can I do that with Revolution ?Hi laurentc, just tried that sample plugin in my local install of Revolution and it works as intended - are you having issues with the above code?
$o = $modx->resource->content;
$o = &$modx->documentObject[’content’];
<?php
switch ($modx->event->name) {
case "OnLoadWebDocument":
$o = &$modx->documentObject[’content’];
// récupération de tous les Npp {-NPP-}
if(preg_match_all( ’~\{-(.*?)\-\}~’ , $o, $tbl_npp)){
$page= ’index.php?id=’.$resource->id;
if($modx->config[’friendly_urls’] == 1){$page = $modx->resource->alias ;}else {$page= ’index.php?id=’.$modx->resource->id ;}
$tbl_npp1 = array_unique($tbl_npp[0]);
for($i=0;$i<count($tbl_npp1);$i++) {
$numbNote = $i+1;
$o = str_replace($tbl_npp1[$i],’<sup><a href="’. $page.’#nb’.$numbNote.’" name="nh’.$numbNote.’">’.($i+1).’</a></sup>’,$o);
}
$npp .= "
--- Notes ---";
for($i=0;$i<count($tbl_npp1);$i++) {
$numbNote = $i+1;
$npp .= ’
[<a href="’. $page.’#nh’.$numbNote.’" name="nb’.$numbNote.’">’.($i+1).’</a>] ’.substr(substr($tbl_npp1[$i],2),0,strlen($tbl_npp1[$i])-4);
}
$o .= $npp;
}
else{
return;
}
break;
default :
break;
}
?>