Forum

Thread tagged as: Question, Problem

Slug appearing in editor form

Hi Drew,

I have a list/detail page set up but in the editor page for the detail an unlabelled field is appearing (which is the slug)

Is this the correct behaviour or should it be hidden and uneditable. This is how its referenced in the template

<perch:content id="slug" type="slug" for="design" suppress="true"/>
Nick Loat

Nick Loat 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is this the master template or a secondary template?

er… its the main template for the content of the detail page. its not a page template though its a content template.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. If you add a label attribute does the label then display?

Can I see your diagnostics report?

I added a label but that dosen't display. Diagnostics follow.


Perch: 2.8.31 Production mode: Production (100) Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), jw_activity_log (1.0.1), dh_ga (1), perch_forms (1.8.3), perch_gallery (2.8.6), perch_blog (5.0), perch_newsfeed (1), perch_comments (1.1), perch_members (1.5), perch_backup (1.2), perch_mailchimp (3.0.1), perch_twitter (3.5.1) DB driver: PDO DB tables: perch2_blog_authors (3), perch2_blog_comments (68), perch2_blog_index (469), perch2_blog_posts (14), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (1), perch2_categories (8), perch2_category_counts (4), perch2_category_sets (2), perch2_content_index (79387), perch2_content_items (1252), perch2_content_regions (129), perch2_forms (1), perch2_forms_responses (245), perch2_jw_activity_log_actions (539), perch2_mailchimp_campaigns (52), perch2_mailchimp_history (90), perch2_mailchimp_imports (0), perch2_mailchimp_lists (1), perch2_mailchimp_log (131), perch2_mailchimp_stats (0), perch2_mailchimp_subscribers (1747), perch2_mailchimp_subscriptions (1747), perch2_mailchimp_webhooks (1), perch2_members (4), perch2_members_forms (0), perch2_members_member_tags (4), perch2_members_sessions (1), perch2_members_tags (2), perch2_navigation (2), perch2_navigation_pages (36), perch2_newsfeed (31), perch2_page_templates (19), perch2_pages (47), perch2_resource_log (17411), perch2_resource_tags (0), perch2_resources (1530), perch2_resources_to_tags (5), perch2_scheduled_tasks (70), perch2_settings (57), perch2_twitter_scheduled_tweets (0), perch2_twitter_settings (1), perch2_twitter_tweets (361), perch2_user_passwords (0), perch2_user_privileges (48), perch2_user_role_privileges (57), perch2_user_roles (2), perch2_users (2) Users: 2 App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_comments', 'perch_forms', 'perch_mailchimp', 'perch_members', 'perch_twitter', 'perch_newsfeed', ); Scheduled tasks for perch_blog: delete_spam_comments (1440 mins) Scheduled tasks for perch_mailchimp: import_data (1 mins) Scheduled tasks for perch_twitter: post_tweets (1 mins), update_tweets (10 mins) Scheduled tasks for jw_activity_log: prune_actions_log (1440 mins) Scheduled tasks for perch_newsfeed: update_news (1440 mins) Editor plug-ins: ckeditor, tinymce, redactor, markitup H1: 79a8ac065165c0a0be89b727cbba9fd0 L1: e1c252c3a4472f148eba51660f761193 F1: 2edba60ed1f613d6dd804feb202456a2 headerColour: #ffffff content_singlePageEdit: 1 helpURL: perch_mailchimp_secret: 60e4accf6814078a980df398cd18fded hideBranding: 1 content_collapseList: 1 lang: en-gb-alt update_2.8.8: done latest_version: 2.8.15 on_sale_version: 2.8.31 headerScheme: light dashboard: 1 hide_pwd_reset: 0 content_hideNonEditableRegions: 1 content_frontend_edit: 0 perch_blog_update: 5.0.1 perch_blog_post_url: /news/post.php?s={postSlug} perch_backup_mysqldump_path: perch_blog_slug_format: %Y-%m-%d-{postTitle} perch_blog_akismet_key: perch_blog_max_spam_days: 1 perch_comments_akismet_key: perch_gallery_bucket_mode: dynamic perch_gallery_bucket: default perch_mailchimp_api_key: d14886cc8f69d57462b8d13ccb0572d6-us4 perch_mailchimp_list_id: a5132b78a9 perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug} perch_members_login_page: /members/login.php?r={returnURL} perch_blog_comment_notify: 1 perch_gallery_basicUpload: 0 siteURL: / perch_mailchimp_update: 2.0 logoPath: /admin/resources/logo-RW.svg update_2.8.10: done perch_twitter_update: 3.5 update_2.8.11: done update_2.8.13: done update_2.8.14: done update_2.8.15: done perch_members_update: 1.4 perch_blog_site_name: Rapture & Wright update_2.8.16: done update_2.8.17: done update_2.8.18: done dh_ga_view_id: 109727104 jw_activity_log_prune_time: 14 update_2.8.19: done update_2.8.20: done update_2.8.21: done update_2.8.23: done update_2.8.24: done update_2.8.25: done update_2.8.27: done update_2.8.28: done update_2.8.29: done update_2.8.30: done update_2.8.31: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: cl18-rapture PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: cl18-rapture PERCH_DB_PREFIX: perch2_ PERCH_TZ: UTC PERCH_EMAIL_FROM: rebecca@raptureandwright.co.uk PERCH_EMAIL_FROM_NAME: Rebecca Aird PERCH_LOGINPATH: /admin PERCH_PATH: /home/sites/raptureandwright.co.uk/public_html/admin PERCH_CORE: /home/sites/raptureandwright.co.uk/public_html/admin/core PERCH_RESFILEPATH: /home/sites/raptureandwright.co.uk/public_html/admin/resources PERCH_RESPATH: /admin/resources PERCH_HTML5: 1 PERCH_SCHEDULE_SECRET: junkanoo 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_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /home/sites/raptureandwright.co.uk/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_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SESSION_TIMEOUT_MINS: 20 PERCH_APPS_EDITOR_PLUGIN: markitup PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile Hosting settings PHP: 5.5.38 Zend: 2.5.0 OS: Linux SAPI: cgi-fcgi Safe mode: not detected MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $ MySQL server: 5.5.47 Free disk space: 8.57 TB Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, sockets, mbstring, tokenizer, xml, cgi-fcgi, bcmath, curl, dom, enchant, fileinfo, gd, imap, intl, json, ldap, exif, mcrypt, mssql, mysqlnd, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, recode, soap, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader, Zend Guard Loader GD: Yes ImageMagick: No PHP max upload size: 50M PHP max form post size: 256M PHP memory limit: 256M Total max uploadable file size: 50M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes PATH: /usr/local/bin:/usr/bin:/bin UNIQUE_ID: V8b1r38AAAEAAeJO37cAAAAG SCRIPT_URL: /admin/core/settings/diagnostics/ SCRIPT_URI: https://raptureandwright.co.uk/admin/core/settings/diagnostics/ HTTP_HOST: raptureandwright.co.uk HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.5 HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_REFERER: https://raptureandwright.co.uk/admin/core/settings/diagnostics/ HTTP_COOKIE: cmsa=1; _ga=GA1.3.1722200809.1472631479; __atuvc=26%7C35; PHPSESSID=m0q4vqfgql1chjrbpdp7chp6l6; __atuvs=57c6f54f1a67b883000; _gat=1 HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_CONNECTION: close SERVER_SOFTWARE: Apache/2.4.23 (Unix) SERVER_NAME: raptureandwright.co.uk SERVER_ADDR: 10.0.1.178 SERVER_PORT: 80 REMOTE_ADDR: 79.77.170.223 DOCUMENT_ROOT: /home/sites/raptureandwright.co.uk/public_html REQUEST_SCHEME: http CONTEXT_DOCUMENT_ROOT: /home/sites/raptureandwright.co.uk/public_html SERVER_ADMIN: root@localhost SCRIPT_FILENAME: /home/sites/raptureandwright.co.uk/public_html/admin/core/settings/diagnostics/index.php REMOTE_PORT: 60862 GATEWAY_INTERFACE: CGI/1.1 SERVER_PROTOCOL: HTTP/1.1 REQUEST_METHOD: GET QUERY_STRING: extended REQUEST_URI: /admin/core/settings/diagnostics/?extended SCRIPT_NAME: /admin/core/settings/diagnostics/index.php PHP_SELF: /admin/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1472656815.378 REQUEST_TIME: 1472656815
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try tidying up the tag?

<perch:content label="Slug" id="slug" type="slug" for="design" suppress="true" />

Done. Still shows up in the editor form.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Still without the label?

No label.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you make other changes to this template and see them take effect?

Yes. I've been tinkering with it most of the afternoon.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you sure it's the slug field you're seeing?

I think so. when I inspect it using the browser tools this is whats being generated in the editor form.

<input id="perch_208_slug" name="perch_208_slug" value="dandaloo" class="text " type="text">
Simon Clay

Simon Clay 127 points

Could you show us your complete detail template?

Sure.

<perch:before></perch:before>
<h1><perch:content id="design" type="smarttext" label="Design" required="true" title="true" /><a href="javascript:history.back();" class="goback"><i class="fa fa-undo"></i>Go back</a></h1>
<div class="sp-loading"><img src="/img/sp-loading2.gif" alt="Loading images" class="spinner"><p class="loading">LOADING&nbsp;IMAGES</p></div>
        <div class="sp-wrap"> 
       <div class="desc"><perch:content id="text" type="textarea" label="Description" html="true" editor="redactor" />
        <h2>Colorways</h2></div>

   <perch:repeater id="design-set" label="Sets" help="Add set images" divider-before="Images" scope-parent="true">
        <a href="<perch:content type="image" id="set" width="1300" height="1300" label="Set: Large" help="Size: 1300 x 1300px (@72dpi)" bucket="Fabric-Sets"/>">
        <img src="<perch:content type="image" id="set" width="466" heigh="466" crop="true"/>" alt="<perch:content id="parent.design"/>: <perch:content type="text" id="alt" label="Colour" required="true" />" /></a>
        </perch:repeater>
        <perch:repeater id="design-swatch" label="Swatches" help="Add design images" scope-parent="true" output="count">
        <a href="<perch:content type="image" id="swatch" width="1300" heigh="1300" crop="true" label="Swatch: Large" help="Size: 1300 x 1300px (@72dpi)" bucket="Fabric-Swatches"/>">
        <img src="<perch:content type="image" id="swatch" width="466" heigh="466" crop="true"/>" alt="<perch:content id="parent.design"/>: <perch:content type="text" id="alt" label="Colour" required="true" />" /></a>
        </perch:repeater>
        </div>



<div class="spec">
<h2>Specification</h2>
<div class="trow">
    <div class="tcol">Repeat:</div><div class="tcol wide"><perch:content id="spec-repeat" type="smarttext" label="Repeat" required="true" divider-before="Specification"/></div>
</div>
<div class="trow">
    <div class="tcol">Width:</div><div class="tcol wide"><perch:content id="spec-width" type="smarttext" label="Width" required="true"/></div>
    </div>
<!--<div class="trow">
    <div class="tcol">No. of colours:</div><div class="tcol"><perch:content id="spec-colours" type="smarttext" label="No. of colours"/></div>
</div>-->
<div class="trow">
    <div class="tcol">Material:</div><div class="tcol wide"><perch:content id="spec-material" type="smarttext" label="Material" required="true" /></div>
    </div>
<div class="trow">
    <div class="tcol">Suitability:</div><div class="tcol wide"><perch:content id="spec-suitability" type="smarttext" label="Suitability" required="true" /></div>
    </div>
<div class="trow last">
    <div class="tcol">Rub test:</div><div class="tcol wide"><perch:content id="spec-rub" type="smarttext" label="Rub test" required="true" /></div>
    </div>
</div>


<perch:if id="wallpaper" match="eq" value="yes">
 <div class="extra">
 <h2>Options</h2>
<perch:content id="wallpaper" type="radio" label="Available as wallpaper?" options="Yes, No" suppress="true"/>

<p><a href="/wallpaper/wallpaper-detail.php?s=<perch:content id="slug" />" class="fabwall"><i class="fa fa-chevron-right"></i>Also available as a wallpaper</a>.</p>   
</div>  
</perch:if>  


<perch:if exists="download-file">   
<h2>Design details</h2>
<ul><li class="download last"><a href="<perch:content  type="file" id="download-file" label="Downloadable PDF" bucket="Design-info" format="MB"/>"><i class="fa fa-file-pdf-o"></i><perch:content id="download-file" format="MB"/></a></li></ul>
</perch:if>
<perch:after></perch:after>

<perch:content id="slug" type="slug" for="design" suppress="true" label="Slug"/>
<perch:content id="list-image" type="image" label="List thumnbnail" width="466" height="466" suppress="true" />
<perch:content id="list-image-alt" type="text" label="Alt text" suppress="true"/>
Simon Clay

Simon Clay 127 points

Hi,

the line that causing the problem is this one, probably due to the slug not having some key attributes like type="slug" and for="design":

<p><a href="/wallpaper/wallpaper-detail.php?s=<perch:content id="slug" />" class="fabwall"><i class="fa fa-chevron-right"></i>Also available as a wallpaper</a>.</p>   

If you change it to this it works

<p><a href="/wallpaper/wallpaper-detail.php?s=<perch:content id="slug" type="slug" for="design"/>" class="fabwall"><i class="fa fa-chevron-right"></i>Also available as a wallpaper</a>.</p>  

Simon, brilliant you're a star.

The template is for display fabrics and the repeater allow the editor to add different colour swatches. Currently at the bottom of the template there is a content tag "list-image" which allows the editor to select an image to show on the listing page. Is there a way to select one of the colour swatches to be the list image without having to add it again as a separate image?

Simon Clay

Simon Clay 127 points

Hi Nick, that's great.

In situations where I need a listing image, I usually have a separate tag for the 'Main Listing Image' followed by a Repeater for 'Additional Images'. Something like:

<!--*Main Listing Image*-->
    <a href="<perch:content type="image" id="list_swatch" width="1300" heigh="1300" crop="true" label="Main Image" help="This will be used for the listing page. Size: 1300 x 1300px (@72dpi)" bucket="Fabric-Swatches"/>
    <img src="<perch:content type="image" id="list_swatch" width="466" heigh="466" crop="true"/>" alt="<perch:content id="design"/>: <perch:content type="text" id="list_alt" label="Colour" required="true" />" /></a>

    <!--*Additional Images*-->    
    <perch:repeater id="design-swatch" label="Additional Swatches" help="Add design images" scope-parent="true" output="count">
        <a href="<perch:content type="image" id="swatch" width="1300" heigh="1300" crop="true" label="Swatch: Large" help="Size: 1300 x 1300px (@72dpi)" bucket="Fabric-Swatches"/>">
        <img src="<perch:content type="image" id="swatch" width="466" heigh="466" crop="true"/>" alt="<perch:content id="parent.design"/>: <perch:content type="text" id="alt" label="Colour" required="true" />" /></a>
    </perch:repeater>

By the way, you should avoid using dashes in all your IDs, and use underscores instead. You'll probably run into problems otherwise.

Simon, many thanks for the above (I'll give that a go this afternoon) and the tip re: hyphens.