I have the following setup:
(a) class Yacht extends dataobject and has ImageGalleryPageID which stores the pageID of a linked Gallery Page.
(b) Template LocationPage uses <% control Yacht %>
What I need to do is to show the gallery(a) into the control of the template (b)
I've tried using the following in class Yacht:
function Gallery() {
$page_link = $this->ImageGalleryPageID;
if (!$page_link) return "";
try
{
$class = "SiteTree";
$where = "'SiteTree.ID'= '$page_link'";
$obj = DataObject :: get($class, $where);
} catch (Exception $e) {
if (!Director :: isDev())
Debug :: Show($e);
}
return $obj;
}
The using the following in the page template:
<% control Yachts %>
<% control Gallery %>
$GalleryLayout
<% end_control %>
<% end_control %>
But this doesn't work. Any help given would be appreciated.