Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SSViewer issue with process() and/or getTemplateContent

Go to End

2 Posts   953 Views


Community Member, 4 Posts

29 March 2012 at 6:02am

Edited: 29/03/2012 6:05am

Hello everyone, having some slight issues with my content being displayed. I've tried a few different methods on the API, to no avail.


ShortcodeParser::get('default')->register('Accordion', array('PageExtension', 'AccordionCall'));

This is fine, at least I think it is. It's firing with no issues. Here is my routine in my page extension class. The array was a blank I fed into process() just to get it to shutup (real technical right there).

Long story short, I want it to display my file. When I use getTemplateContent, it renders it as it's written. As in <% control Accordion %> and so on shows up.

public function AccordionCall() {
$customise = array();

$template = new SSViewer('Accordion');
$item = new ViewableData('Accordion');
return $template -> process($item);

Any help would be appreciated :)


Community Member, 4 Posts

3 April 2012 at 6:51am

public function Accordion(){

return $this-> owner -> renderWith('Accordion');


tada! If I want to load just a certain Holder, I use this

public function AccordionCall($arguments) {

try {
$arg = $arguments;
} catch (Exception $e) {
$arg = null;

//if there's no arguments, it will return everything

if ($arg == null) {
$controlMe = Controller::curr();
return $controlMe-> owner -> renderWith('AccordionAll', $arguments);
} else {
$arg = $arguments['name'];
$current = (DataObject::get_one('AccordionHolder',"AccordionName = '$arg'"));
$item = ($current) ? DataObject::get('Accordion', "ParentID = $current->ID", "", "") : false;
$item -> customise($current);
$controlMe = Controller::curr();
return $controlMe-> owner -> customise($current) -> renderWith('Accordion');



Hope this helps others...