Forum

Thread tagged as: Question, Problem, Configuration

2 detail pages?

Hello again

I have my equivalent portfolio.php (stag-hen-destinations.php) which details and lists cities where both hen and stags can go. All cities apply to both and with perch categories I have attributed a set Destinations with a Hen category and a Stag category and assigned both to each city.

On my individual stag and hen pages I have then generated a list of all cities which click through to the city info. This is fine but this page (my detail.php) destination.php is general for both and I need ideally a separate one for stag and hens so I can filter relevant activities underneath.

Can I somehow have two detail pages/templates? Or add a condition from page came from? I could create separate 'portfolio' pages for hen and stags but this would mean duplication numerous cities across both templates.

Hope this makes sense. Thank you.

Denise Courtney

Denise Courtney 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can do any of those things, as far as I can see.

Which way do you want to do it?

Which would be the most straightforward?

I need to go from stag destinations to individual destination page complete with list of activities available. And the same for hen.

There is a lot of destinations and activities and the list will grow and will in future maybe add more categories/tags to filter if this makes a difference to my choice.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I would keep one detail page, but pass an extra query string argument on the link to pick which 'mode' to throw it into.

Can you give me a little more detail as to how to do this please.

My stag list page I'm coming from is coded with

<?php
  perch_content_custom('Destinations', array(
      'template' => 'dest-list.html',
      'page'=>'/stag-hen-destinations.php',
      'category' => perch_get('cat'),
    ));
  ?>

My list template is

<perch:before>
<ul style="list-style:none; list-style-type:none; margin:0px; padding:0px;">
</perch:before>
<li style="list-style:none; list-style-type:none">
<a href="https://epicweekends.co.uk/stag-hen-destinations.php?s=<perch:content id="slug" type="slug" />" style="color:#333">
<img style="margin-bottom:5px;  border:1px solid #666; border-radius:3px;" src="<perch:content type="image" id="destimage" width="250" height="167" crop="true" />" alt="<perch:content type="text" id="destcity" />" />
<div style="width:150px; position:relative; float:left"><h6><perch:content id="destcity" type="text" />
</h6></div>
<div style="width:75px; position:relative; float:left">
<img src="../../../images/more.png" alt="More info" width="100" border="0" ></div></a>
</li>
<perch:after>
</ul>
</perch:after>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which element should change for your other detail pages?

No other element really just need to differentiate the path to then add another category filter.

If you check out the site so far ..

I have 2 pages listing all destinations...

https://epicweekends.co.uk/stag/stag-destinations.php https://epicweekends.co.uk/hen/hen-destinations.php

Both of these when you select a city go to for example: https://epicweekends.co.uk/destinations.php?s=bath

On this page underneath here I want to list a set of activities relevant hen or stag categories depending on where they have come from.

So I need to add category filters depending on whether they have come from hen or stag sections or send then 2 different ways from the start depending or where they are.

Thank you very much for your time and patience here.

Drew McLellan

Drew McLellan 2638 points
Perch Support

So I would add something to the URL

?type=hen

and then check for it in the page

if (perch_get('type')=='hen') {
    ...  hen stuff ...
}

Sorry I back to this issue now.

where would I add something to the url?

Drew McLellan

Drew McLellan 2638 points
Perch Support

When you create the link to the detail page.