Forum

Thread tagged as: Problem, Blog

Adding stops content from showing

I’ve just updated a site from 2.7.2 to 2.7.10 and I’m having problems with categories in a blog posts listing. Here is the template:

<perch:categories id="categories" set="blog">
<article class="hentry <perch:category id="catSlug" type="slug" />">
    <header>
        <h2>
            <a href="<perch:blog id="postURL" type="hidden" />" rel="bookmark" class="entry-title">
        <perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
      </a>
    </h2>
        <p class="published">published <perch:blog id="postDateTime" type="date" label="Date" time="true" format="%d %B %Y" divider-before="Meta information" /> </p>
    </header>
    <img src="<perch:blog id="image" type="image" width="320" height="320" crop="true" label="Image" order="4" />" alt="<perch:blog id="postTitle" />" />
    <div class="description entry-content">
    <perch:blog id="excerpt" textile="true" />
  </div>
</article>
</perch:categories>

If I take out the <perch:categories> tag the content displays, but with the tag it doesn’t show anything.

Here is the output from diagnostics:

Perch: 2.7.10, PHP: 5.5.17, MySQL: 5.5.38, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (2.7.10), assets (2.7.10), categories (2.7.10), perch_blog (4.5.4), perch_events (1.9), perch_forms (1.8.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_events', 'perch_forms' ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/TwoLittleFishes/Dropbox/sites/annesleyfelley-pc.org.uk/perch
PERCH_CORE: /Users/TwoLittleFishes/Dropbox/sites/annesleyfelley-pc.org.uk/perch/core
PERCH_RESFILEPATH: /Users/TwoLittleFishes/Dropbox/sites/annesleyfelley-pc.org.uk/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/TwoLittleFishes/Dropbox/sites/annesleyfelley-pc.org.uk
HTTP_HOST: annesleyfelley-pc.local:8888
Nick Bramwell

Nick Bramwell 5 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Why is the whole lot wrapped with categories tags? You should just use those for category output.

I was following the example from https://docs.grabaperch.com/docs/categories/template-tags/ where the whole block is wrapped in the categories tags.

What I previously had was:

<perch:categories id="categories" set="blog"><article class="hentry <perch:category id="catSlug" type="slug" />"></perch:categories>
    <header>
        <h2>
            <a href="<perch:blog id="postURL" type="hidden" />" rel="bookmark" class="entry-title">
        <perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
      </a>
    </h2>
        <p class="published">published <perch:blog id="postDateTime" type="date" label="Date" time="true" format="%d %B %Y" divider-before="Meta information" /> </p>
    </header>
    <img src="<perch:blog id="image" type="image" width="320" height="320" crop="true" label="Image" order="4" />" alt="<perch:blog id="postTitle" />" />
    <div class="description entry-content">
    <perch:blog id="excerpt" textile="true" />
  </div>
</article>

But I was having trouble with the opening article tag not being displayed.

Where should the <perch:categories> tags be?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I would do this:

<article class="hentry
<perch:categories id="categories" set="blog"> <perch:category id="catSlug" type="slug" /></perch:categories>
">

Then you'll get a class for each category applied.

Thanks Drew,

I’m still not getting the category slug though.

Could there be anything odd caused by the blog initially being set up with a version of Perch before 2.6 when categories was added to core?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, as long as your categories are in the blog set and are otherwise functioning fine.