Forum

Thread tagged as: Problem, Forum

List Detail - Slug Problem

Hi there,

I seem to be having a problem with the slug field on my list / detail pages. I have added all the items in at the start and all was working fine. But whenever I edited one of the content items, the link to the detail page stopped working.

The Slug field just stopped working. It works on the items that havnt been edited.

Here is the page - https://atw80.com/cocktails/

My Code is the following

<?php
    perch_content_create('Cocktails', array(
    'template'   => 'cocktail_page.html',
    'multiple'    => true,
        'edit-mode' => 'listdetail',
    ));
?>

<?php
    if (perch_get('s')) {

    perch_content_custom('Cocktails', array(
        'template' => 'cocktail_page.html',
        'filter' => 'slug',
        'match' => 'eq',
        'value' => perch_get('s'),
        'count' => 1,
    ));

    } else {

    perch_content_custom('Cocktails', array(
            'template' => '_cocktail_listing.html',
    ));

    }
?>

My templates are the same as your tutorial.

My perch is up to date here is my diagnostic report

Perch: 2.6 Production mode: Production (100) Installed apps: content (2.6), assets (2.6), categories (2.6), perch_events (1.9) DB driver: PDO DB tables: perch2_categories, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_events, perch2_events_categories, perch2_events_to_categories, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users Users: 4 App runtimes: <?php include(PERCH_PATH.'/core/apps/content/runtime.php'); include(PERCH_PATH.'/addons/apps/perch_events/runtime.php'); ?> Scheduled tasks for perch_events: update_category_counts (60 mins) Editor plug-ins: markitup H1: a461ad0748f02cb51320ab25c32ce252 L1: d417304fb6079809e8c1062e72009f99 headerColour: #ffffff content_singlePageEdit: 0 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.3.4: done latest_version: 2.5.3 on_sale_version: 2.6 headerScheme: light dashboard: 0 content_hideNonEditableRegions: 0 logoPath: /admin/resources/new-logo.png perch_events_update: 1.8 perch_events_detail_url: /whatson/event.php?event={eventSlug} update_2.5.3: done update_2.6: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: ucvulfxb_atw80 PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: ucvulfxb_atw80 PERCH_DB_PREFIX: perch2_ PERCH_TZ: UTC PERCH_EMAIL_FROM: barry@fishtankcreative.co.uk PERCH_EMAIL_FROM_NAME: Barry Corrigan PERCH_LOGINPATH: /admin PERCH_PATH: /home/ucvulfxb/public_html/admin PERCH_CORE: /home/ucvulfxb/public_html/admin/core PERCH_RESFILEPATH: /home/ucvulfxb/public_html/admin/resources PERCH_RESPATH: /admin/resources PERCH_HTML5: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/ucvulfxb/public_html/admin/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: HOSTING SETTINGS

PHP: 5.3.28 Zend: 2.3.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: 5.5.37 MySQL server: 5.5.37-cll Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, fileinfo, filter, ftp, gd, gettext, hash, iconv, SPL, intl, json, mbstring, mcrypt, mysql, mysqli, pgsql, session, standard, posix, pspell, Reflection, Phar, SimpleXML, snmp, soap, sockets, imap, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, PDO, pdo_mysql, memcache, imagick, mhash, ionCube Loader, Zend Guard Loader GD: Yes ImageMagick: Yes PHP max upload size: 256M PHP max form post size: 256M PHP memory limit: 256M Total max uploadable file size: 256M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No DOCUMENT_ROOT: /home/ucvulfxb/public_html GATEWAY_INTERFACE: CGI/1.1 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8 HTTP_ACCEPT_ENCODING: gzip,deflate,sdch HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8,fr;q=0.6 HTTP_CONNECTION: keep-alive HTTP_COOKIE: __atuvc=6%7C29; cmsa=1; __utma=234693454.1673799334.1404724922.1408087359.1408356506.26; __utmb=234693454.36.10.1408356506; __utmc=234693454; __utmz=234693454.1404724922.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=eq2245jrjrbd99qqpnu75bmem2 HTTP_HOST: atw80.com HTTP_REFERER: https://atw80.com/admin/core/settings/diagnostics/ HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 PATH: /bin:/usr/bin QUERY_STRING: extended REDIRECT_STATUS: 200 REMOTE_ADDR: 86.2.224.225 REMOTE_PORT: 55154 REQUEST_METHOD: GET REQUEST_URI: /admin/core/settings/diagnostics/?extended SCRIPT_FILENAME: /home/ucvulfxb/public_html/admin/core/settings/diagnostics/index.php SCRIPT_NAME: /admin/core/settings/diagnostics/index.php SERVER_ADDR: 208.76.82.134 SERVER_ADMIN: webmaster@atw80.com SERVER_NAME: atw80.com SERVER_PORT: 80 SERVER_PROTOCOL: HTTP/1.1 SERVER_SOFTWARE: Apache UNIQUE_ID: U-HahtBMUoYAACUT6A4AAAAY PHP_SELF: /admin/core/settings/diagnostics/index.php REQUEST_TIME: 1408359046

Any help on this would be great.

Thanks

Fishtank Creative

Fishtank Creative 2 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me your template?

Ok sure here is my Detail Template:

<section class="clearfix">
    <div class="wrap">
        <ul class="row first">
            <li class="topic-image"><a href="/cocktails/?s=<perch:content id="slug" type="slug" />"><img src="<perch:content id="image" type="image" label="Image" width="400" order="5" />" class="photo"  alt="<perch:content id="title" type="text" label="Cocktail Title" required="true" title="true" order="1" />" /></a></li>
            <li class="topic">
                <h3><a href="/cocktails/?s=<perch:content id="slug" type="slug" />"><perch:content id="title" type="text" label="Cocktail Title" required="true" title="true" order="1" /> <perch:content id="price" type="text" label="Cocktail Price" required="true" order="2" /></a></h3>
                <h4><perch:content id="country" type="text" label="What Part of the World" required="true" order="3" /></h4>
                <perch:content id="desc" type="textarea" label="Description" textile="true" editor="markitup" order="4" />
            </li>       
        </ul>
    </div>
    <div class="divide"></div>
</section>

<perch:content id="slug" for="title" type="slug" suppress="true" />
<perch:content id="thumb" type="image" label="thumbnail" order="12" />

<perch:content id="house" type="checkbox" label="House Cocktail" value="house" suppress="true" order="5" />
<perch:content id="classic" type="checkbox" label="Classic Cocktail" value="classic" suppress="true" order="6" />
<perch:content id="signature" type="checkbox" label="Signature Cocktail" value="signature" suppress="true" order="7" />
<perch:content id="mocktail" type="checkbox" label="Mocktail" value="mocktail" suppress="true" order="8" />
<perch:content id="skinny" type="checkbox" label="Skinny Cocktails" value="skinny" suppress="true" order="9" />
<perch:content id="sharing" type="checkbox" label="Sharing Cocktails" value="sharing" suppress="true" order="10" />
<perch:content id="featured" type="checkbox" label="Featured Cocktail" value="featured" suppress="true" order="11" />

My Listing Template is:

<section class="clearfix" id="<perch:content id="slug" type="slug" />">
    <div class="wrap">
        <ul class="row first">
            <li class="topic-image"><a href="/cocktails/?s=<perch:content id="slug" type="slug" />"><img src="<perch:content id="image" type="image" label="Image" width="400" order="5" />" class="photo"  alt="<perch:content id="title" type="text" label="Cocktail Title" required="true" title="true" order="1" />" /></a></li>
            <li class="topic">
                <h2><a href="/cocktails/?s=<perch:content id="slug" type="slug" />"><perch:content id="title" type="text" label="Cocktail Title" required="true" title="true" order="1" /> <perch:content id="price" type="text" label="Cocktail Price" required="true" order="2" /></a></h2>
                <h4><perch:content id="country" type="text" label="What Part of the World" required="true" order="3" /></h4>
                <perch:content id="desc" type="textarea" label="Description" textile="true" editor="markitup" order="4" />
            </li>       
        </ul>
    </div>
    <div class="divide"></div>
</section>

<perch:content id="slug" for="title" type="slug" suppress="true" />
<perch:content id="house" type="checkbox" label="House Cocktail" value="house" suppress="true" order="5" />
<perch:content id="classic" type="checkbox" label="Classic Cocktail" value="classic" suppress="true" order="6" />
<perch:content id="signature" type="checkbox" label="Signature Cocktail" value="signature" suppress="true" order="7" />
<perch:content id="mocktail" type="checkbox" label="Mocktail" value="mocktail" suppress="true" order="8" />
<perch:content id="skinny" type="checkbox" label="Skinny Cocktails" value="skinny" suppress="true" order="9" />
<perch:content id="sharing" type="checkbox" label="Sharing Cocktails" value="sharing" suppress="true" order="10" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

When you have multiple instances of the same ID in the template, Perch typically uses the first tag. There are a few exceptions (like images, where all the tags are looked at) but you need to make sure the first tag is the one packed with all the attributes for editing.

At the moment, the first slug tag has got no for attribute.

So try moving your suppressed slug tag from the bottom to the top of your template, and then click save.

Thats worked Lovely cheers Drew.