Forum

Thread tagged as: Question, Problem, Blog

perch_blog_categories() not showing any categories

I am using standard perch with the following code;

perch_blog_categories(array(
                        'template'  => 'category_link',
                        'cache'     =>  false,
                        'include-empty' => true
                    ));

I have a category group called products that is used in my post template.

<section class="news--primary // article">
    <time class="date // date--block" datetime="<perch:blog id="postDateTime" type="date" label="Date" time="true" format="Y-m-d H:i:s" order="3" />"><perch:blog id="postDateTime" type="date" time="true" format="%B %e, %Y" /></time>
    <h1 class="news__title"><perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" /></h1>

    <perch:if exists="image">
    <figure class="figure // img-inline--news">
        <img src="<perch:blog id="image" type="image" width="600" label="Article Thumbnail" help="This is only used on the teaser boxes, not in the articles. Recommended that images are square and must be at least 300px wide and 300px high" order="5" divider-before="Image" />"

            srcset="
                <perch:blog id="image" type="image" width="910" /> <perch:blog id="image" type="image" width="910" output="w" />w,
                <perch:blog id="image" type="image" width="850" /> <perch:blog id="image" type="image" width="850" output="w" />w,
                <perch:blog id="image" type="image" width="670" /> <perch:blog id="image" type="image" width="670" output="w" />w,
                <perch:blog id="image" type="image" width="600" /> <perch:blog id="image" type="image" width="600" output="w" />w,
                <perch:blog id="image" type="image" width="455" /> <perch:blog id="image" type="image" width="455" output="w" />w,
                <perch:blog id="image" type="image" width="375" /> <perch:blog id="image" type="image" width="375" output="w" />w,
                <perch:blog id="image" type="image" width="220" /> <perch:blog id="image" type="image" width="220" output="w" />w,

            "
            sizes="
                (min-width: 59.375em) 28vw,
                (min-width: 30em) 48vw,
                100vw
            "
            alt="<perch:blog type="textarea" id="caption" label="Image Caption" required="false" help="e.g. Sarah celebrates with a child after receiving their new Supershoes" title="false" size="xs" order="6" />"
        />
        <perch:blog id="show_caption" type="checkbox" label="Show Image Caption" help="If selected shows the image caption underneath the image" value="1" suppress="true" order="7" />

        <perch:if exists="show_caption">
        <figcaption class="figcaption // figcaption--inline">
            <perch:blog id="caption" type="text" />
        </figcaption>
        </perch:if>
    </figure>
    </perch:if>

    <perch:blog id="postDescHTML" type="textarea" label="Article Text" order="10" editor="markitup" html="true" markdown="true" size="xl autowidth" required="true" help="Please use this block to enter the first sentence/paragraph of the article. The rest you build using the blocks below" divider-before="Article Content" />

    <perch:if exists="datasheets">
        <h3 class="island-top">Datasheet <span>Downloads</span></h3>
        <ul class="downloads">
            <perch:repeater id="datasheets" label="Select Files" divider-before="Datasheets">
            <li>
                <perch:template path="content/file.html" rescope="parent" />
            </li>
            </perch:repeater>
        <perch:after>
        </ul>
    </perch:if>

    <perch:layout path="global/cta" />

    <p class="meta">
        <perch:categories id="cats" set="products" label="Products" display-as="checkboxes" divider-before="Categories">
            <a href="/news/category/<perch:category id="catSlug" type="slug" />/" class="p-category">
                <perch:category id="catTitle" type="text" />
            </a>
        </perch:categories>
    </p>

    <p><a href="/news/" class="back">Back to News</a></p>
</section>

<!--***** Required for Other Templates ****-->

<!--* URL/Slug for article *-->
<perch:blog id="postURL" type="hidden" suppress="true" order="2" />

<!--* Excerpt for article *-->
<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="false" order="4" suppress="true" size="s" count="chars" help="Keep character count to around 320" />


<!--* Images for article list and home *-->
<perch:blog id="image" type="image" width="180" height="180" crop="true" density="1" suppress="true" />
<perch:blog id="image" type="image" width="180" height="180" crop="true" density="2" suppress="true" />
<perch:blog id="image" type="image" width="300" height="300" crop="true" density="1" suppress="true" />
<perch:blog id="image" type="image" width="300" height="300" crop="true" density="2" suppress="true" />

<!--* Images for background fixed image *-->
<perch:blog id="image" type="image" width="600" density="1" suppress="true" />
<perch:blog id="image" type="image" width="600" density="2" suppress="true" />

But when I use the perch_blog_categories() code as above there are no results - no categories are shown in the list.

Any ideas what might be causing this?

Diagnosis as follows;

Perch: 2.8.29
Production mode: Production (100)
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0)
DB driver: PDO
DB tables: perch2_blog_authors (2), perch2_blog_comments (0), perch2_blog_index (2376), perch2_blog_posts (61), perch2_blog_posts_to_tags (147), perch2_blog_sections (1), perch2_blog_tags (138), perch2_blogs (1), perch2_categories (7), perch2_category_counts (4), perch2_category_sets (2), perch2_content_index (122), perch2_content_items (43), perch2_content_regions (12), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (1), perch2_pages (6), perch2_resource_log (332), perch2_resource_tags (95), perch2_resources (622), perch2_resources_to_tags (190), perch2_settings (23), perch2_user_passwords (0), perch2_user_privileges (34), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'content',
        'categories',
        'perch_blog'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup
H1: fe1fd9787fc7df941d5d809d5bb84189
L1: 402b329fb49874544851e77df9a920ae
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #fc5d20
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.29: done
latest_version: 2.8.15
on_sale_version: 2.8.29
headerScheme: dark
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 1
content_frontend_edit: 0
logoPath: /cms/resources/logo-amasci-perch-orange.png
perch_blog_update: 5.0.1
perch_blog_post_url: /news/{postSlug}
perch_blog_site_name: Dengrove
perch_blog_slug_format: %Y/%m/{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: dengrove
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: info@amasci.co.uk
PERCH_EMAIL_FROM_NAME: Terry Upton
PERCH_LOGINPATH: /cms
PERCH_PATH: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com/cms
PERCH_CORE: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com/cms/core
PERCH_RESFILEPATH: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_TZ: UTC
PERCH_HTML5: 1
PERCH_IMAGE_LIB: imagick
PERCH_DEBUG: 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_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com/cms/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
HOSTING SETTINGS

PHP: 5.4.42
Zend: 2.4.0
OS: Darwin
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $
MySQL server: 5.5.42
Free disk space: 344.69 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql, imagick
GD: Yes
ImageMagick: Yes
PHP max upload size: 132M
PHP max form post size: 500M
PHP memory limit: 500M
Total max uploadable file size: 132M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: dengrove.loc
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
HTTP_REFERER: https://dengrove.loc/cms/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.8,en;q=0.6
HTTP_COOKIE: cmsa=1; PHPSESSID=cfe45799ac76c09bb939ef975ad995f7
PATH: /usr/bin:/bin:/usr/sbin:/sbin
SERVER_SOFTWARE: Apache
SERVER_NAME: dengrove.loc
SERVER_ADDR: ::1
SERVER_PORT: 80
REMOTE_ADDR: ::1
DOCUMENT_ROOT: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com
SERVER_ADMIN: you@example.com
SCRIPT_FILENAME: /Users/amasci/Dropbox/Amasci/Websites/Dengrove V3/dengrove.com/cms/core/settings/diagnostics/index.php
REMOTE_PORT: 55639
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /cms/core/settings/diagnostics/?extended
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1461692771.16
REQUEST_TIME: 1461692771
argc: 1
Terry Upton

Terry Upton 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think we have a bug with Blog categories, which is probably the cause of this.

Ok thanks for the update Drew. I don't suppose you have an ETA on a fix at all? :-)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Not currently, I haven't looked at it yet.

Hi Drew, do you have an ETA on a fix at all? Just I have a site supposed to be going live in a weeks time and their blog section is currently a little broken due to this bug.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't have an ETA at all, I'm sorry.

Ok thanks. Is it possible I can revert the site to an older version prior to this bug? I would revert using my version control, but I actually only installed this version of Perch as the starting version...

Thanks.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If it wasn't on an older version there's surely nothing to revert to. Unless I've completely misunderstood.

I meant is there anywhere I can download an older version of Perch, as the downloads section/account only provides access to download the latest version (2.8.29). I thought perhaps I could obtain say 2.8.28 or whatever version where this isn't an issue?

Drew,

I have just upgraded the site to a Runway site instead to see if this would work and if it was a bug with standard Perch or both and it didn't work initially. I then just added the line;

'set'       => 'products',

And this has picked up the categories and is working ok. So I am not sure if this is a bug or not? I don't have any categories for the blog set instead I only use the Products set for blog posts, so each post can be related to a product type.

I do have another site running Runway that uses both Blog categories items as well as a services set too. I have just upgraded this to 2.8.29 and it still works ok without needing to add any sets. So I assume either a set is required if there are no other items from the default blog set? r it is a non-runway bug.

I just thought I would share/report my findings.

Thanks, Terry

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think that sounds like a bug. If you don't specify a set, the default set of blog is used. As you're not using that set, it's correct that nothing was returned. When you specify the set you are using, your content is returned.

So this sounds like it's functioning as it's supposed to.