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.
Another noob question that I am not sure if I am even phrasing correctly!
What is the equivalent of <% control Page(home) %> and <% if BannerImage.PageBanner %> when working inside "Page_Controller extends ContentController"?
I am working through the tutorial at
and would like to access the data/object before the view/template.
What is the equivalent of <% control Page(home) %>...
That is a bit like calling:
$obj = DataObject::get_one('Page', "URLSegment = 'Home'");
$obj would be the object you are 'controlling'.
...and <% if BannerImage.PageBanner %>
This would be equivalent to:
// do stuff
Note that I don't need to use the 'PageBanner', as 'PageBanner' is a method on the 'BannerImage' object. If 'BannerImage' exists, we can assume that $this->BannerImage->PageBanner() will exist.
Hopefully this helps :)
Yes, that is very helpful! Thank you.