List/Detail slug issues

  • Hi,


    A site I built years ago has a bunch of content in a shared region that was displayed on paginated pages. My client would now like the ability to have individual pages for each item in the region.


    I downloaded the list/detail example files and had them up and running just fine. I changed the region names in the list/detail example page to the already populated shared region name, then updated the listing and detail templates. Content shows up in the list view, but the slug link doesn't show the slug name in the URL and I'm unable to click through to a detail view of that item.


    Any ideas?


    Here's the content:


    products.php: (The only thing changed from the demo files are the region name and template names)


    <?php include('../perch/runtime.php'); ?>

    <!doctype html>

    <html lang="en">

    <head>

    <meta charset="utf-8" />

    <title>List Detail Example Page</title>

    </head>

    <body>


    <?php


    perch_content_create('Author and Book', array(

    'template' => 'author_detail.html',

    'multiple' => true,

    'edit-mode' => 'listdetail',

    ));



    if (perch_get('s')) {


    // Detail mode

    perch_content_custom('Author and Book', array(

    'template' => 'author_detail.html',

    'filter' => 'slug',

    'match' => 'eq',

    'value' => perch_get('s'),

    'count' => 1,

    ));


    } else {


    // List mode

    perch_content_custom('Author and Book', array(

    'template' => 'author_listing.html',

    ));

    }


    ?>


    </body>

    </html>


    author_listing.html:

    <perch:before>


    </perch:before>


    <a href="?s=<perch:content id="slug" type="slug" />">

    <perch:content id="booktitle" type="text" />

    </a>


    <perch:after>


    </perch:after>


    author_detail:


    <h1><perch:content id="booktitle" type="text" label="Product title" required="true" title="true" /></h1>


    <perch:content id="slug" for="booktitle" type="slug" suppress>




    Thanks!

  • drewm

    Approved the thread.
  • Entering a slug manually just brings up a blank page. I tried the for="booktitle" addition, but that didn't change things. It's a mystery to me. I've done plenty of list/detail setups before but never trying to apply a list/detail setup to a preexisting shared region of content.

  • If the slug only shows up for one item then could this mean the slug tag been added to the template after creating the regions? You may need to resave the regions to generate the slugs for the rest of the items.


    Clive's manual url tip is a good one. Also to make it easier to debug, output the slug to the page (not in an a tag) in the listing template so you can see it.