Site structure is:
News (3)
|____News numero 1 (4)
|____News numero 2 (6)
I have created 3 TV for my template to use with Ditto:
titolo -> Input Type=Text area
immagine -> Input Type=Image
descrizione -> Input Type=Text area (mini)
Then I created the chunk template_news for Ditto call
<h1>[+tvtitolo+]</h1>
[[verifica]]
<p>[+tvdescrizione+]</p>
The snipper [[verifica]] is a check for TV immagine. If is present return the HTML image tag else return nothing.
<?php
$output='';
$idimmagine=$modx->getTemplateVarOutput('immagine',$modx->documentIdentifier);
if($idimmagine['immagine']!='') $output.='<img src="' . $idimmagine['immagine'] . '" />';
return $output;
?>
In the News page (id=3) I call:
[[Ditto? &tpl=`template_news` &startID=`3` &summarize=`3` ]]
Now the problem is in the snippet [[verifica]] on the parameter $modx->documentIdentifier
It return 3 (id of page/container News) and don’t show the image that I have inserted in TV, but I want that it return 4 for first news, 6 for second news, etc...
How I make this loop in php? Is possible?