Hi guy’s i’am wondering how it is possible to check the content of the current document and if it is empty then
load the content of another document and put it in the content zone of the current document.
exemple :
$doc = $modx->getDocumentObject(’id’,$docid);
$contenu = $doc[’content’];
...
...
// Taking the content from the other document ...
objects = $modx->getDocumentObject(’id’,$docid2);
$contAct = $objects[’content’];
...
...
if ($contenu == ""){
// Injecting the new content in the current document [*content*] zone
$modx->setPlaceHolder(’content’, $contAct);
}
Quote from: bekergu at Feb 22, 2008, 10:17 AM
Hi guy’s i’am wondering how it is possible to check the content of the current document and if it is empty then
load the content of another document and put it in the content zone of the current document.
exemple :
$doc = $modx->getDocumentObject(’id’,$docid);
$contenu = $doc[’content’];
...
...
// Taking the content from the other document ...
objects = $modx->getDocumentObject(’id’,$docid2);
$contAct = $objects[’content’];
...
...
if ($contenu == ""){
// Injecting the new content in the current document [*content*] zone
$modx->setPlaceHolder(’content’, $contAct);
}
It might be safer to just redirect them to the other document if the current one is empty.
Wouldn’t it be easier just to make sure that all your documents have some content in them?
Bob