We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Problem, Error, Blog

blog post list adding sectionTitle stops post image from displaying

Hi I'm working with the blog add-on in Perch and noticed that if I add

<perch:blog id="visible" type="checkbox" value="1" label="Show on site">

to the post_in_list.html template it stops the 'image' path being returned. When I <perch:showall/> the image entry is just completely empty despite there being an image associated to the post. If I remove the line, the image comes back.

post_in_list.html template (returning no image):

<perch:before>
    </perch:before>


        <h2><a href="<perch:blog id="postURL" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a></h2>
        <div>



<perch:if exists="image">
            <img src="<perch:blog id="image" type="image" width="50" height="50" crop="true" />" alt="<perch:blog id="postTitle" />" />
</perch:if>
</div>
        <p class="entry-published date"><perch:blog id="postDateTime" format="%d %B %Y" /></p>
        <div class="description entry-summary">
        <perch:blog id="excerpt" type="textarea" textile="true" />

            <perch:blog id="sectionTitle" type="text" />

        <!--* <p>Comments: <perch:blog id="postCommentCount"/></p> *-->
        </div>


<perch:after>

    <perch:if exists="paging">
        <div class="paging">
            Page <perch:blog id="current_page" /> of <perch:blog id="number_of_pages" />
            <perch:blog id="page_links" encode="false" />
            <perch:if exists="not_first_page">
                <a href="<perch:blog id="prev_url" encode="false" />">Previous</a>
            </perch:if>
            <perch:if exists="not_last_page">
                <a href="<perch:blog id="next_url" encode="false" />">Next</a>
            </perch:if>
        </div>
    </perch:if>
</perch:after>


<perch:showall/>

I’m calling it from the page using:

<?php
    perch_blog_custom(array(
        'count'=>4,
        'cache'=> false,
        'template'=>'post_in_list.html',
    ));
?>

debug message

Debug Message - Perch 3.1.2
[29] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/news/index.php' OR regionPage='*' ORDER BY regionPage DESC
[2] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_blog_index idx JOIN perch3_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch3_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2018-09-03 21:12:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 4
[1] SELECT FOUND_ROWS() AS `count`
[2] Using template: /templates/blog/post_in_list.html
[4] SELECT * FROM perch3_blog_sections ORDER BY sectionTitle ASC
[1] SELECT * FROM perch3_blogs ORDER BY blogTitle ASC
[1] SELECT * FROM perch3_blogs WHERE blogSlug='blog' LIMIT 1
[4] SELECT *, sectionID AS _id, sectionPostCount as qty FROM perch3_blog_sections WHERE 1=1 AND blogID=1 ORDER BY sectionTitle ASC
[3] Using template: /templates/blog/section_list.html

Since it returns sectionID I thought adding the line to get the sectionTitle would be OK to do? Is there another way to do this?

Thanks

Graham Shedden

Graham Shedden 0 points

  • 1 year ago