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:

Customising the CMS /

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

Static page customization

Go to End

3 Posts   560 Views


Community Member, 2 Posts

14 October 2013 at 10:02am

Edited: 14/10/2013 10:03am


I'm trying to create a static page with some customization in it.

In my ProjectPage.php i have:

class ProjectPage_Controller extends Page_Controller
	 function init()
	 function myCustomFunction()
		  $name = 'BLAH';
		  echo '<a href="'.$name.'">link</a>';


And in my i have something like:


The problem is the function is called BEFORE everything else (ie. before <html>) & not at the point between the divs.

Can anyone help as to why?



Community Member, 545 Posts

14 October 2013 at 6:23pm

I'm not sure on the full template processing pipeline but HTML is not genreated procedurally. Functions are processed then the HTML is genereted so if you want a function to output a value into the template at it's insertion point you need to use return instead of echo.

return '<a href="'.$name.'">link</a>';


Community Member, 2 Posts

14 October 2013 at 6:30pm