Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Controlling ImageGallery Menu: Current etc.

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 972 Views
  • pinkp
    Avatar
    Community Member
    168 Posts

    Controlling ImageGallery Menu: Current etc. Link to this post

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

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Controlling ImageGallery Menu: Current etc. Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Controlling ImageGallery Menu: Current etc. Link to this post

    What exactly are you trying to do?

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Controlling ImageGallery Menu: Current etc. Link to this post

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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Controlling ImageGallery Menu: Current etc. Link to this post

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

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