Forum
Runway Blog App: images in entries and listings not showing
In Runway Blog App - I'm trying to show a blog post image in both my post listing (blog/post_in_list.html) and post entry page (pages/post.php) using the template blog/post.html.
I can't work out why it won't show in either the listing or the entry. I have checked that an image has been uploaded and it shows in the admin area. I have referenced the documentation and I'm sure that the image field is correct. Both pages are using the templates. Everything else in the post shows without problems. #stumped
Post Entry Page
pages/post.php
<?php perch_blog_post(perch_get('s')); ?>
blog/post.html
<perch:if exists="image">
<img src="<perch:blog id="image" type="image" width="500" label="Image" order="6" />" alt="<perch:blog id="postTitle" escape="true" type="text" label="Title" />" />
</perch:if>
Listing Page
blog/post_in_list.html
<perch:if exists="image">
<img src="<perch:blog id="image" type="image" width="500" />" alt="<perch:blog id="postTitle" escape="true" />" />
</perch:if>
pages/feed.php
<?php
perch_blog_custom([
'template' => 'post_in_list.html',
'each' => function($post) {
$blog_album = perch_blog_post_field($post['postSlug'], 'album', true);
$html = perch_gallery_album($blog_album, [
'count' => 4,
'template' => 'c_list_image.html',
], true);
$post['gallery_html'] = $html;
return $post;
}
]);
?>
That looks ok to me. What does
<perch:showall />
output?Thats handy... This is what I get. perch_image is referencing the correct image.
Does your section template also have a field with ID
image
?Section details are loaded in so there could be a naming conflict.
I no longer have the image in the section template (I removed it). However when I remove the following section content elements from post_in_list.html and post.html the entry image does show.
Is there an appropriate way to include section content in those template files?
Have you re-saved the section to update the data?
I have saved the template after making a change. What do you mean by re-saved the section?
You'd added an image field with a conflicting ID to the blog section. Have you edited that section since to remove the conflicting content?
I deleted some of my old blog posts and it seemed to do the job. Thanks Drew.