ok, I might be getting closer. Yeah, I must have entered the tv name incorrectly.
but NOW, the widget is printing only one character.... the second character ONLY! If I enter "Test" (in the sidebarTV field) it prints <div class="sidebarContent">e</div>
If I enter 123, it prints... <div class="sidebarContent">2</div>!
Any idea why?
Thanks in advance!
EDIT: I see it has to do with the array....
changing
<?php
// sidebarWidget snippet
// parameters:
// &tvname - Set the TV name to be used, defaults to sidebarTV
$TVname = isset($tv)?$tv:'sidebarTV';
// fetch the output array of the TV
if( $TVarray = $modx->getTemplateVarOutput(array($TVname)) ){
#TV output is in index [$TVname][1]
$tvOutput = $TVarray[$TVname][1];
if(empty($tvOutput)) return ''; //bail out if no value
// Here is where we can start customizing the output.
// For now, just return the TV output in a <div> container
return '<div class="sidebarContent">'.$tvOutput.'</div>';
}
return '';
?>
to..
<?php
// sidebarWidget snippet
// parameters:
// &tvname - Set the TV name to be used, defaults to sidebarTV
$TVname = isset($tv)?$tv:'sidebarTV';
// fetch the output array of the TV
if( $TVarray = $modx->getTemplateVarOutput(array($TVname)) ){
#TV output is in index [$TVname][2]
$tvOutput = $TVarray[$TVname][2];
if(empty($tvOutput)) return ''; //bail out if no value
// Here is where we can start customizing the output.
// For now, just return the TV output in a <div> container
return '<div class="sidebarContent">'.$tvOutput.'</div>';
}
return '';
?>
changes the 2 to a 3 (if I enter 123 - SO, that must be where I put a regular expression? And if so, how would I print EVERYTHING?)