Is there a way to pre-populate chunks on a event?
I have a template, chunks, and now i want to create some code that popuplates the chunks so that i can keep everything in 1 file, why i do it this way. I don't want all kind of [[customSnippet? &property=`this`]]. Sure if the way i would like it is not posible i will do it in the snippet way.
What i was thinking
<?php
global $modx;
$currentId = $modx->resource->get('id');
$objectPageId = 15;
if( $modx->event->name == 'OnWebPagePrerender' && $currentId == $objectPageId )
{
$soapCall = 1;
include(MODX_ASSETS_PATH.'snippets/config.php');
include(MODX_ASSETS_PATH.'snippets/functions.php');
include(MODX_ASSETS_PATH.'snippets/debug.php');
$path = $_GET['q'];
$pathPatterns = explode('/', $path);
if( !isset( $pathPatterns[2] ) && !is_numeric( $pathPatterns[2] ) ) return '';
$currentObject = $pathPatterns[2];
$soapObjectParams = array('language' => 'nl');
$soapParams = array("user" => $soapUser, "password" => $soapPassword, 'yachtId' => $currentObject, "parameters" => $soapObjectParams);
try {
$objectArray = unserialize(base64_decode($client->__soapCall('getDetails', $soapParams)));
} catch (SoapFault $e) {
debugSoap($client);
}
}
Now all that remains is some way to populate the chunks... i know how to do it from a snippet but not from out a plugin.