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.

Themes /

Discuss SilverStripe Themes.

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

Images not appearing in Gallery


Go to End


16 Posts   5261 Views

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 1:22pm

Gallery.ss

Avatar
helenclarko

Community Member, 166 Posts

9 September 2015 at 1:35pm

Edited: 09/09/2015 1:36pm

Hi RobboNoCash,

Can you paste your code files (.SS file and .PHP) using something like http://kopy.io/ or http://www.sspaste.com/ or https://gist.github.com/ and then paste the link here.

-helenclarko

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 1:41pm

Hi

This is;

Gallery.php http://kopy.io/3h46H
Gallery.ss http://kopy.io/WMvyZ

Thanks

Avatar
helenclarko

Community Member, 166 Posts

9 September 2015 at 2:43pm

Hi RobboNoCash,

Sorry, I'm a little slow today. Took me a little while to click onto whats happening here.

You are already referencing the image when you run your loop over it.
So, you can simply call $URL to get the images URL.

<% loop Picture %> 
      $URL
    <div class="row service-list">
      <div class="col-md-2 tp-service-block"><!-- tp Service Block Start-->
        <div class="tp-thumb-pic"><!--service pic start --> 
          <a class="fancybox" rel="example_group" href="$URL"> <% if PictureSmall %><% loop PictureSmall %><img class="img-responsive" src="$URL" alt=""><% end_loop %><% end_if %> </a>
        </div>
      </div>
    <% end_loop %>

The issue is that you need to loop through both $Picture and $PictureSmall.

-helenclarko

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 3:14pm

Hi helenclarko

Thanks a lot for your help I really appreciate it.
The URL for the picture is printing.
But the PictureSmall is not working, do you know why??

Thanks

Avatar
helenclarko

Community Member, 166 Posts

9 September 2015 at 3:46pm

Edited: 09/09/2015 3:49pm

Hi RobboNoCash,

Probably because the PictureSmall loop is being called from within the Picture loop... My Bad!

<% if Picture %>
    <div class="row service-list">
      <div class="col-md-2 tp-service-block"><!-- tp Service Block Start-->
        <div class="tp-thumb-pic"><!--service pic start --> 
         <% loop Picture %><a class="fancybox" rel="example_group" href="$URL"><% end_loop %><% if PictureSmall %><% loop PictureSmall %><img class="img-responsive" src="$URL" alt=""><% end_loop %><% end_if %></a>
        </div>
      </div>
<% end_if %> 

Avatar
RobboNoCash

Community Member, 33 Posts

9 September 2015 at 4:23pm

Hi

That is not working either, it is looping to the end of the Picture and all the PictureSmall is linking to the final Picture.

Thanks

Avatar
Nivin17

Community Member, 1 Post

10 January 2016 at 10:52pm

Sure thing. To change it from post's featured images to page's...

1) Make a child theme.
2) Add in "template-imagegallery.php" to the child-theme.
3) Replace the following text:
<?php query_posts( 'showposts=60&post_type=post' ); ?>
with
<?php query_posts( 'showposts=60&post_type=page' ); ?>

Java training in chennai | Android training in chennai | Oracle dba Training in Chennai | Python Training in chennai

Go to Top