//<?php
$e = &$modx->Event;
$output ='';
switch($e->name) {
case 'OnManagerWelcomeHome':
// set parent ID
$parentId = '4';
// set the tpl - can also be done in chunks and use chunk name in the param array
$rowTpl = 'homeCustom';
$outerTpl = '@CODE: <h3 class="h3pad">Current Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
// set params for Wayfinder - params needs to be an array
$params['startId'] = $parentId;
$params['level'] = '1';
$params['ignoreHidden'] = 'TRUE';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
// execute snippet
$output = $modx->runSnippet('Wayfinder', $params);
break;
default:
$output = '';
break;
}
$e->output($output);
return;
How about putting all the code in one plugin? Then you can generate the output in any order you like.
Quote from: BobRay at Feb 20, 2010, 08:05 PM
How about putting all the code in one plugin? Then you can generate the output in any order you like.
I tried that before seperating the 3 plugins and it would only display 1 for some reason
// set params
$output = $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
// set params
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
// set params
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
$e->output($output);
Quote from: BnH at Feb 20, 2010, 08:06 PM
Quote from: BobRay at Feb 20, 2010, 08:05 PM
How about putting all the code in one plugin? Then you can generate the output in any order you like.
I tried that before seperating the 3 plugins and it would only display 1 for some reason
Did you append the Wayfinder output to the $output variable with .= and have only one $e->output($output); at the very end of the plugin? Something like this:
// set params $output = $modx->runSnippet('Wayfinder', $params); $output .= '<hr />'; // set params $output .= $modx->runSnippet('Wayfinder', $params); $output .= '<hr />'; // set params $output .= $modx->runSnippet('Wayfinder', $params); $output .= '<hr />'; $e->output($output);
// params
My example is kind of a diagram for the whole plugin.
Where I put the
// params
lines is where you would set all the params for each Wayfinder call (including the parents). IOW, the code from each of your three plugins that sets the params would go where those three comments are.
thx!
//<?php
$e = &$modx->Event;
$output ='';
// set params
switch($e->name) {
case 'OnManagerWelcomeHome':
// set parent ID
$parentId = '4';
// set the tpl - can also be done in chunks and use chunk name in the param array
$rowTpl = 'homeCustom';
$outerTpl = '@CODE: <h3 class="h3pad">Current Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
// set params for Wayfinder - params needs to be an array
$params['startId'] = $parentId;
$params['level'] = '1';
$params['ignoreHidden'] = 'TRUE';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output = $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
// set params
switch($e->name) {
case 'OnManagerWelcomeHome':
// set parent ID
$parentId = '34';
// set the tpl - can also be done in chunks and use chunk name in the param array
$rowTpl = 'homeCustom';
$outerTpl = '@CODE: <h3 class="h3pad">Pending Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
// set params for Wayfinder - params needs to be an array
$params['startId'] = $parentId;
$params['level'] = '1';
$params['ignoreHidden'] = 'TRUE';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
$e = &$modx->Event;
$output ='';
// set params
switch($e->name) {
case 'OnManagerWelcomeHome':
// set parent ID
$parentId = '27';
// set the tpl - can also be done in chunks and use chunk name in the param array
$rowTpl = 'homeCustom';
$outerTpl = '@CODE: <h3 class="h3pad">Sold Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
// set params for Wayfinder - params needs to be an array
$params['startId'] = $parentId;
$params['level'] = '1';
$params['ignoreHidden'] = 'TRUE';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
$e->output($output);
return;<?php
//Plugin attached to OnManagerWelcomeHome System Event
$e = &$modx->Event;
$output ='';
// set generic params
$rowTpl = 'homeCustom';
$params['level'] = '1';
$params['ignoreHidden'] = 'TRUE';
// set params for Current Properties and call Wayfinder
$outerTpl = '@CODE: <h3 class="h3pad">Current Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
$params['startId'] = '4';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output = $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
// set params for Pending Properties and call Wayfinder
$outerTpl = '@CODE: <h3 class="h3pad">Pending Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
$params['startId'] = '34';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
// set params for Sold Properties and call Wayfinder
$outerTpl = '@CODE: <h3 class="h3pad">Sold Properties</h3><ul class="ulpad">[+wf.wrapper+]</ul>';
$params['startId'] = '27';
$params['rowTpl'] = $rowTpl;
$params['outerTpl'] = $outerTpl;
$output .= $modx->runSnippet('Wayfinder', $params);
$output .= '<hr />';
$e->output($output);
return;