Forum

Thread tagged as: Question, Problem, Blog

Perch content not showing

Hey folks!

I need a bit of guidance. I updated my perch from 2.6.x to 2.8 a few weeks back, and it appeared pretty seamless. I had a quick check of a few pages on my site to ensure all was working and left it at that.

What I neglected to check was the actual blog post pages. Having taken a look this morning, my blog post pages aren't showing any content. The archives show the correct titles but clicking through to each post shows a page devoid of the blog post. An example is here > https://mrqwest.co.uk/blog/553/adventures-with-fullscreen

I've taken a look into the post.php template I use and this bit of code is meant to be pulling in the content but isn't.

<?php perch_blog_post(perch_get('s')); ?>

Am I calling that right?

What can I do to trouble shoot & fix this?

Anthony Killeen

Anthony Killeen 0 points

  • 6 years ago

I've just followed the debug process mentioned here and here's my output: -

SELECT * FROM perch2_blog_posts WHERE postID=553 AND postStatus='Published' AND postDateTime<='2015-04-30 08:02:00'
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
Using template: /templates/blog/post.html
SELECT main.* FROM perch2_blog_posts main WHERE main.postID=553 LIMIT 1
Using template: /templates/blog/post.html
Fetching from cache: perch_blog_post_categoriesfa021134a9ca802be9bd287f69ff7add
Cache file not found: perch_blog_post_categoriesfa021134a9ca802be9bd287f69ff7add
Using template: /templates/blog/post_category_link.html
Fetching from cache: perch_blog_post_tags901ec7815a9660a7a73e794c80c35fc2
Cache file not found: perch_blog_post_tags901ec7815a9660a7a73e794c80c35fc2
SELECT t.* FROM perch2_blog_tags t, perch2_blog_posts_to_tags p2t WHERE t.tagID=p2t.tagID AND p2t.postID=553
Using template: /templates/blog/post_tag_link.html
SELECT * FROM perch2_blog_comments WHERE 1=1 AND postID=553 AND commentStatus='LIVE' ORDER BY commentDateTime ASC
Using template: /templates/blog/comment.html
Using template: /templates/blog/comment_form.html
Array
(
    [type] => 8
    [message] => Undefined variable: items
    [file] => /home/mrqwestc/public_html/mrqwest/perch/core/lib/PerchFactory.class.php
    [line] => 1120
)

The Array at the bottom was highlighted in Red.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you on the latest version of Blog?

Yes Drew, or at least I think I am. 4.6 is the latest isn't it?

From Diagnostics:

Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_blog (4.6), perch_comments (1.1)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the above all of the debug output from the bottom of your page? If so, how is the slug being translated to postID 553 in your setup?

Drew, yes, that's the entire contents of the debug info. It's on my live site (trying to fix when I'm not at home) so the debug info is still shown on the page if you want to inspect > https://mrqwest.co.uk/blog/553/adventures-with-fullscreen

Under the blog settings, I've got this for a post slug > /blog/{postID}/{postSlug}

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great.

Did you update your post.html template when you updated last time?

https://docs.grabaperch.com/addons/blog/installation/

Drew, I don't think I did but that's not the issue. I uploaded the new post.html file into perch/templates/blog and it's still not outputting the content.

It works on other pages using perch_blog_custom... would it be easier to run with that?

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_blog_post() uses perch_blog_custom() under the hood, so if that works then go for it.

You do need to make sure your post template is up to date though.

Thanks Drew...

I've taken a different approach. I noticed that the title was displaying correctly using perch_blog_post_field(perch_get('s'), 'postTitle');.

So I replaced perch_blog_post with

<?php perch_blog_post_field(perch_get('s'), 'postTitle'); ?>
<?php perch_blog_post_field(perch_get('s'), 'postDescHTML'); ?>

and it all works happily. I wonder what's different between these & perch_blog_post().

Obviously this works but isn't ideal. Any other thoughts on how I could retain use of the post.html template?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you now updated the post.html template, or does it still use legacy fields?