Forum
Blog Not Rendering
Hi
I'm having a problem after having updated to the latest version of perch and the blog app. The posts aren't rendering they appear in the list but when click to view the full thing it doesn't out put anything where the post should be on the page. It's all working fine in the admin too.
The blog update has run and i've manually re-run it. I've also tried using the example post.html template and it still doesn't work. It should be getting the right post as from the debug code i've run the sql manually that it does. It is probably just something i've overlooked as everything else is running fine on the latest perch.
Diagnostics are:
Perch: 3.0.9, PHP: 5.6.30, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.9), assets (3.0.9), categories (3.0.9), perch_blog (5.6.1), perch_forms (1.9.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms'); ?>
PERCH_LOGINPATH: /admin
PERCH_PATH: /var/www/vhosts/domain.co.uk/site2/admin
PERCH_CORE: /var/www/vhosts/domain.co.uk/site2/admin/core
PERCH_RESFILEPATH: /var/www/vhosts/domain.co.uk/site2/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 2M, Max POST 8M, Memory: 128M, Total max file upload: 2M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/
DOCUMENT_ROOT: /var/www/vhosts/domain.co.uk/site2
HTTP_HOST: domain.co.uk
The template i'm using is as follows, but as i say i have used the example one as well:
<h1 class="h1" itemprop="headline"><a href="<perch:blog id="postURL" type="hidden"/>" rel="bookmark" class="entry-title"><perch:blog id="postTitle" type="text" required="true" size="xl" label="Title" order="1" /></a></h1>
<h2 class="h2" itemprop="genre"><perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes">
<a href="archive.php?cat=<perch:category id="catSlug" type="slug" />">
<perch:category id="catTitle" type="text" />
</a>
</perch:categories></h2>
<!--
<div class="author-text"><time itemprop="datePublished" datetime="<perch:blog id="postDateTime" format="%Y-%m-%d." type="date" label="Date" time="true" order="11"/>"><perch:blog id="postDateTime" format="%d.%m.%Y" /></time><span class="updated"><time itemprop="dateModified" datetime="<perch:blog id="postDateTime" type="date" format="%Y-%m-%d." />"></time> by <a href="<perch:blog id="google-link" type="hidden"/>" itemprop="author" title="Written by <perch:blog id="authorGivenName" type="hidden"/>" rel="author" target="_googleplus" class="fn"><perch:blog id="authorGivenName" type="hidden" /></a></div>
//-->
<perch:if exists="image">
<section class="blog-banner">
<img src="<perch:blog id="image" type="image" label="Banner Image" width="1264" height="704" crop="true" help="This image should be 1264 x 704" order="2" />" alt="<perch:blog id="postTitle" />" />
</section>
</perch:if>
<section class="blog-text clearfix" itemprop="articleBody">
<perch:blog id="postDescHTML" type="textarea" html="true" editor="ckeditor" required="true" size="xl" imagewidth="1264" label="Main Article" order="3" />
</section>
<perch:blog id="excerpt" type="textarea" label="Excerpt" html="false" required="true" order="4" suppress="true" size="s" divider-before="List Page Content"/>
<perch:blog id="list-image" type="image" width="480" height="240" crop="true" suppress="true" label="Listing Image" help="This image should be 480 x 240" order="5" />
<perch:blog id="meta-title" type="textarea" label="Meta Title" html="false" required="true" order="6" suppress="true" size="s" divider-before="Meta/SEO Content" />
<perch:blog id="meta-keywords" type="textarea" label="Meta Keywords" html="false" order="7" suppress="true" size="s" />
<perch:blog id="meta-description" type="textarea" label="Meta Description" html="false" required="true" order="8" suppress="true" size="s" />
<perch:blog id="h1-tag" type="text" label="H1 Tag" html="false" required="true" order="9" suppress="true" size="xl" />
<meta property="og:title" content="<perch:blog id="postTitle" escape="true"/>"/>
<meta property="og:type" content="article"/>
<meta property="og:image" content="<perch:blog id="base-url" type="hidden" /><perch:blog id="list-image" />"/>
<meta property="og:url" content="<perch:blog id="base-url" type="hidden" /><perch:blog id="postURL" type="hidden"/>"/>
<meta property="og:description" content="<perch:blog id="excerpt" escape="true" />"/>
<meta name="twitter:card" content="summary">
<meta name="twitter:url" content="<perch:blog id="base-url" type="hidden" /><perch:blog id="postURL" type="hidden"/>">
<meta name="twitter:title" content="<perch:blog id="postTitle" escape="true"/>">
<meta name="twitter:description" content="<perch:blog id="excerpt" escape="true" />">
<perch:if exists="twitter-image">
<meta name="twitter:image" content="<perch:blog id="base-url" type="hidden" /><perch:blog id="twitter-image" type="image" label="Twitter Image" width="120" height="90" crop="true" help="This image should be 120 x 90" order="10" />">
</perch:if>
And the diagnostics report is:
Debug Message - Perch 3.0.9
[28] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='wrong-place-wrong-time')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-09-15 11:26:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
Using template: /templates/blog/post.html
[1] SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
[1] SELECT * FROM perch2_blogs ORDER BY blogTitle ASC
[1] SELECT * FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2017-09-15 11:26:00' AND postSlug='wrong-place-wrong-time'
Using template: /templates/blog/post.html
Using template: /templates/blog/post.html
Using template: /templates/blog/post.html
[6] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/blog/post.php' OR regionPage='*' ORDER BY regionPage DESC
Using template: /templates/blog/post.html
[25] SELECT * FROM perch2_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[1] SELECT pageTreePosition FROM perch2_pages WHERE pagePath='/blog/post.php' LIMIT 1
[2] SELECT pageID FROM perch2_pages WHERE pageTreePosition IN ('000-006-001', '000-006', '000') ORDER BY pageTreePosition DESC
[7] Using template: /templates/navigation/item.html
[1] SELECT main.* FROM perch2_blog_posts main WHERE main.postID=433 LIMIT 1
Using template: /templates/blog/post.html
Fetching from cache: perch_blog_post_categoriesfc8fb795df33ac1ff97de5b3c5b1d8c3
Caching: perch_blog_post_categoriesfc8fb795df33ac1ff97de5b3c5b1d8c3
[3] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='postDateTime' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue != 'wrong-place-wrong-time')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-09-15 11:26:00' ) GROUP BY itemID, sortval ORDER BY sortval DESC LIMIT 0, 3
[1] SELECT FOUND_ROWS() AS `count`
[3] Using template: /templates/blog/related_articles.html
[1] SELECT * FROM perch2_blog_posts WHERE postID=433 AND postStatus='Published' AND postDateTime<='2017-09-15 11:26:00'
Using template: /templates/blog/comment_form.html
[nil] SELECT * FROM perch2_blog_comments WHERE 1=1 AND postID=433 AND commentStatus='LIVE' ORDER BY FIELD(webmentionType, 'like', 'repost', 'comment', NULL) ASC, commentDateTime ASC
[0] Using template: /templates/blog/comment.html
[1] SELECT groupID FROM perch2_navigation WHERE groupSlug='footer-menu' LIMIT 1
[2] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch2_navigation_pages np, perch2_pages p WHERE p.pageID=np.pageID AND np.groupID=2 AND p.pageNew=0 AND np.pageDepth >=0 AND np.pageDepth<=1 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch2_pages p, perch2_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=2 AND p.pagePath='/blog/post.php' LIMIT 1
[2] Using template: /templates/navigation/item.html
Array
(
[type] => 8
[message] => Undefined variable: items
[file] => /var/www/vhosts/domain.co.uk/site2/admin/core/lib/PerchFactory.class.php
[line] => 1248
)
Hopefully it's just something i haven't done right, but do you have any ideas.
Thanks
On the settings page is the blog URL format, is this correctly set for your blog?
Also see: https://docs.grabaperch.com/addons/blog/updating/
Is anything output from the template?
Hi Drew/Robert,
Robert, yes url formatting is fine it is picking up the correct id for the post as far as i can see and i've been through the update docs and can't see anything i'm doing wrong there.
Drew, it looks like there is nothing coming back from my call to perch_blog_post i'm passing it the post id and from the debug info it has the right one and the sql running with that id returns the info. There are legacy urls which i try to catch from old inbound links this is the post.php script in case there is an issue with it:
Sorry for the delay with the reply didn't have notifications turned on. Will pick up on this on Monday.
Thanks
Have you tried a simpler example to isolate the issue?
Hi Drew,
I'm not sure why but i tried changing from using the post id to the slug and it's fixed the issue.
from
to
solved the problem i thought it could take either but as long as it's working now then it's all good