Forum

Thread tagged as: Question, Problem, Gallery

Error loading album lightbox using gallery app.

I've installed the gallery app, it works in the control panel in that I can create an album and upload images.

I've copied the default templates folder (gallery) across to /templates/ folder all as per:

https://docs.grabaperch.com/addons/gallery/page-functions/

I can view a text link to the gallery in the webpage I've created but when I click on the link which produces the following I get a 404 error:

https://xxxx.co.uk/album.php?s=gallery-name-here

What am I doing wrong?

Andrew Areoff

Andrew Areoff 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have an album.php file?

I have an album.html file in the /perch/templates/gallery folder.

Do I need a physical webpage in the front of the site?

If so, what perch code do I need to add to it?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

There are examples included in the download.

Thanks! this has got me a long way forward.

I've used Example C - the lightbox.

What perch code would I use to trigger the lightbox of images direct from the gallery index.php page.

I'm using this code:

<?php perch_gallery_albums(array( 'template'=>'c_album-image.html', 'image'=>true )); ?>

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think you need any Perch code - you should just be able to add your lightbox script to that page.

I've put this into my gallery home page:

    <?php 
        if(perch_get('s')) {
            perch_gallery_album_images(perch_get('s'), array(
               'template'   =>'c_list_image.html'
            ));
        } ?>

But it doesn't display anything when I do.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, so the first line is if (perch_get('s')) { ... is there an ?s=something value on the URL? If not, this code won't do anything.

s=bike-vault-gallery in the URL.

Sorry, I'm not a coder so this is difficult for me to get working.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

If you just drop our example folder into your site do the examples work? Do you see your galleries and images?

Oh yes Rachel. All works fine. Just trying to clean up the look and avoid going through two screens to get to the gallery images on the front end. Is there a way I can share the site with you privately so you can see what I've got?

Drew McLellan

Drew McLellan 2638 points
Perch Support

So what does this do if you enter your album slug?

perch_gallery_album_images('album-slug', array(
    'template'   =>'c_list_image.html'
));

That's work great in giving me a list of the images but now it doesn't display the images in the lightbox which it did previously. It only display them singly full size in the browser when clicked.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

What HTML are you not getting that you expect, in order to make the lightbox work?

The reason I asked you to check our examples worked, was to check if the Gallery is actually installed and working correctly. It's a debugging step.

Otherwise, if you have some markup you need Perch to generate in order for the lightbox to work you should be able to view source and see if Perch is creating the correct markup. If it is not then you need to edit the template.

This on the index page:

<?php perch_gallery_albums(array( 'template'=>'c_album-image.html', 'image'=>true )); ?>

And this on the album page:

<?php 
        if(perch_get('s')) {
            perch_gallery_album_images(perch_get('s'), array(
               'template'   =>'c_list_image.html'
            ));
        } ?>

gives me the lightbox.

This on the index page:

                    <?php 
        perch_gallery_album_images('bike-vault-gallery', array(
'template'   =>'c_list_image.html'

)); ?>

gives me the gallery images listed out which is what I want but doesn't click through to the lightbox. That's the issue.

Nothing else has changed.

I hope that makes sense.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you added the lightbox JavaScript and CSS to your page? What happens when you click on the link?

Oops! Schoolboy error! Fixed now.

Thanks again.