I'm running through the 3.0 tutorials (http://doc.silverstripe.org/framework/en/tutorials/2-extending-a-basic-site). I'm supposed to create a function in the HomePage.php controller called LatestNews. According to the tutorial the rule of thumb is the following:
"The controller for a page is only created when page is actually visited, while the data object is available when the page is referenced in other pages, e.g. by page controls. A good rule of thumb is to put all functions specific to the page currently being viewed in the controller; only if a function needs to be used in another page should you put it in the data object."
My problem is that when I put the function in the controller it is exposed for everyone at the url http://localhost/home/LatestNews and I get an error when navigating to it. When I put it in the data object it's not exposed and I get a page not found.
I've tried with private and protected without any success. Is there anyway to not expose a controller method but still use it in the templates?