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.

Customising the CMS /

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

Different Renderer. Replace SSViewer with different template system

Go to End

3 Posts   1576 Views


Community Member, 2 Posts

20 December 2010 at 3:50pm

Hello, there are many existing PHP renderers (ex mustache or smarty) and I already use one.

I'm trying to integrate silverstripe into my system, but the problem is SSViewer is hardcoded into silverstripe.

What is the best way to replace it?

I would prefer silverstripe developers to extract an interface from SSViewer so that we can create an adapter to another view renderer and safely substitute SSViewer. And also create a factory class that would select correct renderer for each template.


Forum Moderator, 5523 Posts

20 December 2010 at 6:31pm

There is an effort going on to replace SSViewer. I'm not sure if this will allow other engines to be plugged in but more details will be available once it's near release ( I doubt an easy 'plug and play' system for templates is going to be possible as even with the new template engine things like data structures / orm based features are still very tightly coupled to framework and going to be quite hard to abstract.

Remember seeing someone hack smarty rendering into SS2.3 (try a search) but it wasn't a practical addition to the framework.


Community Member, 2 Posts

21 December 2010 at 4:28am

For now I managed to post-process output and modify it before it is sent to the browser.
Also for now I managed to get it mostly working with my output renderers by including generated string into SSViewer output.

One more question, is it possibile to include the output of the method call into SSViewer? i.e instead of $var to do $func()

class GemsPage_Controller extends Page_Controller {
	private function gemsFilter($rawOutput) {
                  // perform search and replace here

	function handleRequest(SS_HTTPRequest $request) {

		$response = parent::handleRequest($request);
		$rawOutput = $response->getBody();
		$translationFilter = new TranslationFilter();
		$cssFileter = new CssFilter(true);
		$jsFilter = new JsFilter(true);

		return $response;

	public function handleAction($request) {
		$result = parent::handleAction($request);
		return $this->gemsFilter($result);