Forum

Thread tagged as: Question, Problem, Runway

URL routing with a list and detail page

HI

I am having trouble getting a list and detail page to work in runway.

I have a staff-detail page with a name, phone number, image and quote at the bottom i have

<perch:content id="slug" for="director-name" type="slug" suppress="true" />

again in normal perch you add a

 RewriteRule ^about/directors/([a-zA-Z0-9-/]+)$ /about/directors.php?s=$1 [L]

in you htaccess file and then in your list page you add

<perch:before>
<ul>
</perch:before>
<li>
 <a href="/about/directors/<perch:content id="slug" type="slug" />">

      <perch:content id="director-name" type="text" />
 </a>
</li>
<perch:after>
</ul>
</perch:after>

this works perfectly

using the same thing in runway i can not get the slug to work. I clearly am not getting URL patterns

i add the the directors page which is /about/directors-profiles.php and add a url pattern of

/about/director/[slug]

i get the page but only the first director i add is shown, when i click on the director name the slug is not working.

please help

Regards,

Brett

Brett Warne

Brett Warne 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you referencing the slug in your page? It may be simplest to name it:

about/director/[slug:s]

Then you can use

perch_get('s')

If you wanted to leave it unnamed, you would use its (zero-indexed) segment number

perch_get(2)

Brett,

Make sure your location path is set correctly. I had a problem with list and details pages but as long as I had the location path correct it worked like a charm.

Try putting the following in your location path.

/about/directors.php

That makes sense except where do I add the perch_get In regular perch you have a detail page with all the fields you need and at the bottom of it you add the slug.

Perch_content id=slug for=director-name type=slug

Then in your listing page you reference the slug


Perch:before <ul> Perch:before <li> <a href="/about/directors/<perch:content id=slug type=slug> />

Then the field you want to display to click on.

Where do I put the perch:get. In the a href of the listing page.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where you used to have pages in Perch, you now have Master Pages in your templates/pages folder (and below).

Thanks

added the if perch_get(s) to the directors-profile page and works now, thanks for being patient.

Brett

Drew McLellan

Drew McLellan 2638 points
Perch Support

No problem.