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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Controlling ImageGallery Menu: Current etc.


Go to End


5 Posts   1324 Views

Avatar
pinkp

Community Member, 182 Posts

2 June 2010 at 8:31am

This code works just fine for my top level menu but I can't get it to work correctly for the ImageGallery menu a little advice would be appreciated.

The result at the moment means it uses the first else html so the image rollover is always active and the current page is not defined.

ImageGalleryPage_album.ss

... 
<ul id="Menu2">
         <% control Albums %>
             <% if GalleryMenuImg %>
    <% if LinkOrSection = section %>
		<li id="Menu2item" class="$LinkingMode"><a class="$LinkingMode" href="$Link" title="$AlbumName"><img src="$GalleryMenuImg2.URL" name="$AlbumName" title="$AlbumName" height="35px" border="0" id="$AlbumName" /></a></li>
	<% else %>
	<li id="Menu2item" class="$LinkingMode"><a class="$LinkingMode" href="$Link" title="$AlbumName" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('$AlbumName','','$GalleryMenuImg2.URL',1)"><img src="$GalleryMenuImg.URL" title="$AlbumName" name="$AlbumName" height="35px" border="0" id="$AlbumName" /></a></li>
	<% end_if %>
<% else %>
<!-- debug: menu image missing for page $Title -->
      <li  class="$LinkingMode"><a href="$Link" title="$AlbumName">$AlbumName</a></li>
	  <% end_if %> 
            				<% end_control %></ul>
...

Avatar
pinkp

Community Member, 182 Posts

5 June 2010 at 9:08am

Any body got any hints for me on this I've tried every combination of Page Controls but can't get it to recognise this is the current album and therefor change the HTML. LinkingMode works fine for the CSS class but as my example show's I want to do more than that is this not achievable or am I missing something simple!? thanks

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 June 2010 at 9:17am

What exactly are you trying to do?

Avatar
pinkp

Community Member, 182 Posts

5 June 2010 at 10:01am

Hi UC, I wish to use:

<% if LinkorCurrent = current %>

in the ImageGallery menu to define between the current Album and the rest. I am trying to use the above control or equivalent so I can control the HTML as I am using images for the menu. The code I posted works fine for the Page.ss Menu but the ImageGallery ignores <% if LinkorCurrent = current %> and goes straight to the <% else %> for all menu links.

The LinkingMode method in ImageGallery works fine of course but I need more control then just the CSS class.

I hope that is clearer thanks!!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 June 2010 at 12:33pm

ImageGalleryAlbum doesn't have a LinkOrCurrent function.. just LinkingMode, which returns "link" or "current".. remember, an Album is not a page.. it's a DataObject, so it doesn't get the same properties as the usual SiteTree objects. I'm not really sure why an Album would return "section" in the first place... ??