Jump to:

23453 Posts in 18902 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Template Control Question

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 755 Views
  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Template Control Question Link to this post

    Hello,

    I am attempting to use the SimplePicasaGallery module and pull content to another page. I'm a bit of a silverstripe noob so be warned.

    I have the following in a theme template. I created a SimplePicasaGallery page named "pics". I'm attempted to pull one of the functions and display photo thumbs. I can't get any of the functions in the page_controller to call from the control tag for the template. In this case I'm tyring to call PIcasaAlbumList which should have a $Thumb url that would be displayed. However the following code does not display anything.

    Note: If I go to the pics page everything displays so I know it is working.

    Here's my code:
    <% control Page(pics) %>
    <% control PicasaAlbumList %>
          <a href='$Top.Link/viewalbum/$Id'>
             <img src="$Thumb" alt="$Description" <% if ShowDescription %>title="$Description"<% end_if %>/>
          </a>
       <% end_control %>
    <% end_control %>

  • MagicUK
    Avatar
    Community Member
    60 Posts

    Re: Template Control Question Link to this post

    Are you sure that 'pics' is the URL segment of the picasa page? Double check 'meta data' tab. My hunch is it might be something else?

  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Re: Template Control Question Link to this post

    Its pics. I purposely named it to make it easy.

    So what am I missing to make this work?

  • MagicUK
    Avatar
    Community Member
    60 Posts

    Re: Template Control Question Link to this post

    Try putting something like this in the controller for the page you want to bring the picassa page into:

       function ShowPicsPage(){
             $get = DataObject::get_one('TheClassNameOfYourPicassaPicsPage', "URLSegment = 'pics'");
             return new TheNameOfThePicasa_Controller($get);
       }

    Then in your template:

    <% control ShowPicsPage %>
    <% control PicasaAlbumList %>
    <a href='$Top.Link/viewalbum/$Id'>
    <img src="$Thumb" alt="$Description" <% if ShowDescription %>title="$Description"<% end_if %>/>
    </a>
    <% end_control %>
    <% end_control %>

  • ChurchDude
    Avatar
    Community Member
    19 Posts

    Re: Template Control Question Link to this post

    Sweet!!!

    It works. Thanks Magic. I have learned something more about Silverstripe!!!

    755 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.