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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Template Control Question


Go to End


5 Posts   1437 Views

Avatar
ChurchDude

Community Member, 19 Posts

22 August 2011 at 12:38pm

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 %>

Avatar
MagicUK

Community Member, 60 Posts

22 August 2011 at 8:56pm

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?

Avatar
ChurchDude

Community Member, 19 Posts

23 August 2011 at 12:37am

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

So what am I missing to make this work?

Avatar
MagicUK

Community Member, 60 Posts

23 August 2011 at 12:49am

Edited: 23/08/2011 12:49am

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 %>

Avatar
ChurchDude

Community Member, 19 Posts

26 August 2011 at 12:55am

Sweet!!!

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

:)