Jump to:

10977 Posts in 2720 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 2635 Views
  • joninjas
    Avatar
    Community Member
    32 Posts

    start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page Link to this post

    Hi,

    I'd also like to start (for example) LightBox directly from a link on a picture somewhere on a silverstripe website (not just from the supported gallery page).

    Could someone please give me a hint?

    Cheers
    Jonas

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page Link to this post

    I am also trying this, so far I've been able to get it to work by using the following lines in my new 'MyPage.ss', whilst having the image_gallery mod installed:

    <script type="text/javascript" src="jsparty/jquery/jquery.js"></script>
    <script type="text/javascript" src="image_gallery/gallery_ui/lightbox/javascript/jquery.lightbox-0.5.js"</script>
    <script type="text/javascript" src="image_gallery/gallery_ui/lightbox/javascript/lightbox_init.js"></script>

    <link rel="stylesheet" type="text/css" href="image_gallery/gallery_ui/lightbox/css/jquery.lightbox-0.5.css" />
    <link rel="stylesheet" type="text/css" href="image_gallery/css/ImageGallery.css" />

    And this in my .ss

    <% if Photo %>
    <a rel="lightbox" class="lightbox" title="$Title" href="$Photo.URL"><% control Photo.SetWidth(130) %><img src="$URL"<% end_control %>alt="$Title"/><% end_if %>


    This is presuming you have the $Photo and $Title fields in your PHP and the above is to create a custom alt whilst also setting the Photo width.

    But it seems to have an issue and is showing multiple images in the count even when there is only 1... but this may be my .ss file not sure yet.

  • web2works
    Avatar
    Community Member
    50 Posts

    Re: start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page Link to this post

    If only it used a more advanced template language this could be done in one line. Such a good framework let down by the template.

  • web2works
    Avatar
    Community Member
    50 Posts

    Re: start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page Link to this post

    Yeah I am giving it a go. I have been used to working with Smarty I think I am just finding such a difference but I love the framework and whole MVC logic.

    The first thing I came across was using the 2 IF statements that I couldnt do in the template (maybe its not supposed to go in the template) but I was trying to wrap a simple IF statement round a subnav where in smarty I would of done:
    I ended up with this:
    <% if LinkingMode == current %> mainNav-Sub_Always<% end_if %><% if LinkingMode == section %> mainNav-Sub_Always<% end_if %>
    {if $LinkingMode eq 'current' || $LinkingMode == 'section'}

    I have bought the book so when that arrives will hopefully that gets me going.

  • _Vince
    Avatar
    Community Member
    161 Posts

    Re: start a gallery (LightBox) by klicking an image on a 'normal' silverstripe page Link to this post

    I had a similar question some time ago. I wanted to open a lightbox by clicking on a photo in the actual page content.

    It was suggested, at the time, that I do a string replace in the PHP. Create a function called Content() and then do a bit of string manipulation, putting the link around the "<img>" tag.

    That's always possible, too.

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