Forum

Thread tagged as: Problem, Error

Perch blocks empty until blog post published

Hi,

A potential bug.

I have some perch blocks set up within a blog post type template. When adding them they were appearing empty (no fields) as if they had no content.

After 30 mins of head banging I discovered once the article was published they appeared fine, but as the blog post begins life as a draft this was very confusing.

Sarah Evans

Sarah Evans 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Sarah

can we see your template and Diagnostics Report?

Rachel

Template:

<h1>     
        <perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />

</h1>
<perch:if exists="image">
        <img src="<perch:blog id="image" type="image" width="725" height="483" crop="true" label="Image" order="2" />" alt="<perch:blog id="postTitle" />" />
</perch:if>


<perch:blocks>
  <perch:block type="texthighlight" label="Text Highlight">
     <br>
     <div class="description highlight">
        <perch:blog id="postDescHTMLhighlight" type="textarea" label="Post Text in Highlight Box" order="3" markdown="true" editor="markitup" size="xl autowidth" required="true" imagewidth="725" bucket="recipes" />

    </div>
  </perch:block>

  <perch:block type="text" label="Text">
    <br>
    <div class="description entry-content">
        <perch:blog id="postDescHTML2" type="textarea" label="Post Text" order="4" markdown="true" editor="markitup" size="l autowidth" required="true" imagewidth="725" bucket="recipes" />

    </div>

  </perch:block>


    <perch:block type="video2" label="Video">
        <br>
    <h2>Video</h2>

            <perch:blog id="video2" type="textarea" order="5" html="true" editor="markitup" label="Video Code" size="xs" />

  </perch:block>

</perch:blocks>



<perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes" suppress="true">
    <a href="archive.php?cat=<perch:category id="catSlug" type="slug" />" class="p-category">
        <perch:category id="catTitle" type="text" />
    </a>
</perch:categories>



<div class="recipe-info">
<p class="recipe-date"><perch:blog id="postDateTime" type="date" label="Date" time="true" format="%d %B %Y" divider-before="Meta information" /></p>

</div>


<div class="description entry-content">
<perch:blog id="postDescHTML" type="textarea" label="Post Text" order="2" markdown="true" editor="markitup" size="xxl autowidth" required="true" imagewidth="725" bucket="recipes" />

</div>


    <perch:blog id="meta_description" type="textarea" label="Meta Description" suppress="true" size="xs" />
    <perch:blog id="meta_keywords" type="textarea" label="Meta Keywords" suppress="true" size="xs" />

Debug


[1] SELECT * FROM perch2_blog_posts WHERE postStatus='Published' AND postDateTime<='2016-04-26 17:27:00' AND postSlug='testy' [33] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0 [6] SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC [1] SELECT * FROM perch2_blogs ORDER BY blogTitle ASC Using template: /templates/blog/posts/inspiration-on-a-plate.html Using template: /templates/blog/posts/inspiration-on-a-plate.html Using template: /templates/blog/posts/inspiration-on-a-plate.html [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='testy')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2016-04-26 17:27:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10 [1] SELECT FOUND_ROWS() AS `count` [1] Using template: /templates/blog/posts/inspiration-on-a-plate.html Fetching from cache: perch_blog_post_categories3158f8bfd580b7f4eb1f48d7d85640b5 Fetching from cache: perch_blog_post_tagsb1dfa4da5e6474c5ace1c58c95f75253 Cache file not found: perch_blog_post_tagsb1dfa4da5e6474c5ace1c58c95f75253 [nil] SELECT t.* FROM perch2_blog_tags t, perch2_blog_posts_to_tags p2t WHERE t.tagID=p2t.tagID AND p2t.postID='400' [] Using template: /templates/blog/post_tag_link.html [8] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/reviews-rambles/post.php' OR regionPage='*' ORDER BY regionPage DESC Using template: /templates/search/search-form-custom.html [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.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl LEFT JOIN perch2_blog_posts_to_tags p2t ON tbl.postID=p2t.postID LEFT JOIN perch2_blog_tags t ON p2t.tagID=t.tagID WHERE ( tagSlug IN ('featured') AND postStatus='Published' AND postDateTime<='2016-04-26 17:27:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 1 [1] SELECT FOUND_ROWS() AS `count` [1] Using template: /templates/blog/post-featured.html [1] SELECT * FROM perch2_pages WHERE pagePath='/reviews-rambles/post.php' LIMIT 1 - See more at: https://local.natuallysassy/reviews-rambles/testy#sthash.17R37RF9.dpuf
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Is Perch and the Blog App up to date? We can't tell what we are dealing with without the Diagnostics Report which makes it harder to help.

All up to date.


Perch: 2.8.29 Production mode: Production (100) Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0), perch_events (1.9.2), perch_forms (1.7), perch_mailchimp (2.0.1) DB driver: PDO DB tables: perch2_blog_authors (4), perch2_blog_categories (9), perch2_blog_comments (0), perch2_blog_index (9945), perch2_blog_posts (369), perch2_blog_posts_to_categories (119), perch2_blog_posts_to_tags (660), perch2_blog_sections (6), perch2_blog_tags (238), perch2_blogs (1), perch2_categories (37), perch2_category_counts (32), perch2_category_sets (1), perch2_content_index (1578), perch2_content_items (1260), perch2_content_regions (146), perch2_events (6), perch2_events_categories (1), perch2_events_to_categories (2), perch2_forms (1), perch2_forms_responses (308), perch2_mailchimp_campaigns (12), perch2_mailchimp_history (0), perch2_mailchimp_log (0), perch2_mailchimp_stats (1), perch2_mailchimp_subscribers (0), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (6), perch2_pages (40), perch2_resource_log (3333), perch2_resource_tags (67), perch2_resources (2943), perch2_resources_to_tags (163), perch2_settings (34), perch2_user_passwords (0), perch2_user_privileges (44), perch2_user_role_privileges (28), perch2_user_roles (2), perch2_users (3) Users: 3 App runtimes: <?php $apps_list = array( 'content', 'perch_blog', 'perch_forms', 'categories', 'perch_events', ); ?> Scheduled tasks for perch_blog: delete_spam_comments (1440 mins) Scheduled tasks for perch_events: update_category_counts (60 mins) Scheduled tasks for perch_mailchimp: update_list_stats (60 mins) Editor plug-ins: markitup H1: 37477242425c94a895eb369297b37a06 L1: 56ec3158b055fa54f4351b9384ea29b4 F1: 2edba60ed1f613d6dd804feb202456a2 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.4.9: done latest_version: 2.8.15 perch_blog_post_url: /{sectionSlug}/{postSlug} perch_blog_update: 5.0.1 headerScheme: light perch_blog_slug_format: {postTitle} perch_blog_akismet_key: perch_blog_max_spam_days: 0 dashboard: 0 hide_pwd_reset: 0 content_hideNonEditableRegions: 0 content_frontend_edit: 1 perch_blog_comment_notify: 0 perch_mailchimp_secret: 1e125a17dd334c04378067ace425e021 perch_mailchimp_update: 2.0 perch_mailchimp_api_key: c1a13bceb956121cd069d5d4e643428a-us8 perch_mailchimp_list_id: 337989 perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug} logoPath: /perch/resources/naturally-sassy.png update_2.6.6: done perch_events_update: 1.8 perch_events_detail_url: /events/event.php?event={eventSlug} update_2.8.2: done update_2.7.10: done on_sale_version: 2.8.29 update_2.8.29: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: root PERCH_DB_SERVER: localhost PERCH_DB_DATABASE: local_naturallysassy PERCH_DB_PREFIX: perch2_ PERCH_TZ: Europe/London PERCH_EMAIL_FROM: hello@sarahevansdesign.co.uk PERCH_EMAIL_FROM_NAME: Sarah Evans PERCH_LOGINPATH: /perch PERCH_PATH: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build/perch PERCH_CORE: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build/perch/core PERCH_RESFILEPATH: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build/perch/resources PERCH_RESPATH: /perch/resources PERCH_HTML5: 1 PERCH_DEBUG: 1 PERCH_RUNWAY: PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_RUNWAY_ROUTED: PERCH_STRONG_PASSWORDS: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build/perch/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_SESSION_TIMEOUT_MINS: 20 HOSTING SETTINGS PHP: 5.4.30 Zend: 2.4.0 OS: Darwin SAPI: apache2handler Safe mode: not detected MySQL client: 5.5.38 MySQL server: 5.5.38 Free disk space: 59.04 GB Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, mysql, mysqli, session, PDO, pdo_sqlite, standard, posix, Reflection, Phar, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, apache2handler, imap, gettext, mcrypt, yaz, pgsql, pdo_pgsql, pdo_mysql GD: Yes ImageMagick: No PHP max upload size: 32M PHP max form post size: 32M PHP memory limit: 128M Total max uploadable file size: 32M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: Yes HTTP_HOST: local.natuallysassy HTTP_CONNECTION: keep-alive HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36 HTTP_REFERER: https://local.natuallysassy/perch/core/settings/diagnostics/ HTTP_ACCEPT_ENCODING: gzip, deflate, sdch HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8 HTTP_COOKIE: cmsa=1; __unam=38cc876-1485f7ec49a-4745ab5-3911; PHPSESSID=8570fd5f5b04f780b6235efeb9bf9915 PATH: /usr/bin:/bin:/usr/sbin:/sbin SERVER_SOFTWARE: Apache SERVER_NAME: local.natuallysassy SERVER_ADDR: ::1 SERVER_PORT: 80 REMOTE_ADDR: ::1 DOCUMENT_ROOT: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build SERVER_ADMIN: you@example.com SCRIPT_FILENAME: /Users/lilone3585/Documents/Google Drive/htdocs/naturallysassy/Build/perch/core/settings/diagnostics/index.php REMOTE_PORT: 57573 GATEWAY_INTERFACE: CGI/1.1 SERVER_PROTOCOL: HTTP/1.1 REQUEST_METHOD: GET QUERY_STRING: extended REQUEST_URI: /perch/core/settings/diagnostics/?extended SCRIPT_NAME: /perch/core/settings/diagnostics/index.php PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1461741347.84 REQUEST_TIME: 1461741347 argc: 1
Drew McLellan

Drew McLellan 2638 points
Perch Support

Hi Sarah - this is really odd. Your template is working perfectly for me, no blank blocks.

I wonder if it might be a caching issue of some sort. Have you recently updated from an older version?

Hi Drew,

I updated Perch and Blog a week or so ago. I've just tested new browser and same issue.

I'm using post types, just to be clear it's only an issue when I create a new post and it's in draft mode, fine once published. I can work around this for now in development, then see if it happens when I upload it to its staging area.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I've got pretty much the same setup for my own blog and I've never seen this. I often have posts in draft for a couple of days when working on them. So there must be something different somewhere. Would be interesting to see if it happens in staging as that would rule out any environment oddity.