Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Use a Gallery in another page

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 508 Views
  • sca123
    Avatar
    Community Member
    61 Posts

    Use a Gallery in another page Link to this post

    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.

    508 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.