Oke I made some progress with my snippit!
I figured out I can get a chunk to display with the code:
$projects = $modx->getCollection('Project');
foreach ($projects as $project) {
if ($i % 2 != 0)
$rowTpl = $modx->getChunk($tplRow);
else
$rowTpl = $modx->getChunk($tplRow);
echo $rowTpl;
}
But how do I get the ’name’ from the Projects in the [[+name]] placeholder of my chunk?
Thanks!
EDIT:
I got it to work!!! With the following code.
$projects = $modx->getCollection('Project');
foreach ($projects as $project) {
$name = $project->get('name');
$rowTpl = $modx->getChunk($tplRow,array(
'name' => $name,
));
Is this the correct way to handle SQL data?
The only thing left for now is the form problem. Damn I’m proud of myself as I have never worked with PHP before xD