10378 Posts in 2194 Topics by 1710 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 253 Views |
-
SSViewer issue with process() and/or getTemplateContent

29 March 2012 at 6:02am Last edited: 29 March 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.
_config.php
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 Accordion.ss 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
-
Re: SSViewer issue with process() and/or getTemplateContent

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...
| 253 Views | ||
|
Page:
1
|
Go to Top |

