We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Configuration

Galery Listing/Detail Pages

Is there a better way to achieve this:

So I have for example products/gallery-envelopes which has a gallery listing in it, the listing and detail pages are created using pages/subpages in the pages app. So I have a directory called gallery-envelopes with index.php and detail.php inside it.

When you click on an item it takes you to e.g. products/gallery-envelopes/dave

On my detail page I have created a link back to the listing page. Currently i have added it as /index.php which does the job however the url shows as:

products/gallery-envelopes/index.php

However I would prefer it to show as products/gallery-envelopes/

Which is how it shows when first visited.

Is this a .htaccess thing?

I tried using the link as / but this goes back to the site index. I saw <?php perch_pages_parent_page(); ?> in the docs but this cannot be used inside a template.

Nigel Coath

Nigel Coath 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have index.php in the link you created? If so, remove it.

But if I do that how can I link back to the root of this section? Both reside in the same folder.

The reason I cannot hard code the exact path is because I am using the same list/detail templates for 5 separate galleries. Each displays a gallery page filtered by the category.

However the detail page does reside in the same folder as the index.php (the gallery listing page).

Okay stumbled on it.

href="./" seems to work! I tried ../ and that obviously went back to the previous directory, but that seems to take it just back to the containing folder.

I hope its cross-browser correct as it works okay in Safari.