Forum

Thread tagged as: Question, Problem, Configuration

Perch block content not appearing if image field contains upload

Hi there,

I have a shared multi-item region called services. Inside are a couple of core fields such as title and image. I have two image fields for producing two sizes from the same ID. The rest of the users fields for adding content are coming from block content via a template include.

When I save my region - aftering add a service - all my block content vanishes or sometimes, one is left behind. Images to appear to be working correctly when output and I can't find any reason why this is happening. However if I leave my image field blank, the block content works correctly.

I've double checked for duplicate IDs and blank fields. I've also tried changing IDs on the image field in question. I'm using the most recent version of Perch.

The template:

<div class="page-Banner sub-Page" style="background-image:url(<perch:content id="serv_image" type="image" label="Service Image" crop="true" width="1600" height="600" />);">
    <div class="page-Banner_Text">
        <div>
            <h1><perch:content id="serv_name" type="text" label="Service title" required></h1>
        </div>
    </div>
</div>

<div class="service-Specific is-Padded">
    <div class="contain">
        <perch:content id="slug" type="slug" for="serv_name" editable="true" label="Slug" label="Service Image" help="Sets the URL in the address bar" suppress>
        <perch:content id="serv_image" type="image" width="900" height="600" crop="true" suppress>
        <perch:content id="is_featured" type="checkbox" label="Is this service featured?" help="Featured will output the service on the homepage" value="featured" suppress>

        <div class="anchored-Content">
            <div class="anchored-Content__nav">
                <perch:if exists="heading_nav">
                <div><perch:content id="heading_nav" encode="false" type="hidden"></div>
                </perch:if>
            </div>

            <div class="anchored-Content__content">
                <div class="content-anchor">
                    <perch:template path="content/service_blocks.html" rescope="parent" />
                    <perch:layout path="global/services_cta">
                </div>
            </div>
        </div>
    </div>
</div>

No errors are coming up in the debug so I have nothing to follow at the moment. My blocks include looks like:

<perch:blocks>
    <perch:block type="heading" label="Single Heading" icon="pencil">
        <div class="block-Heading e-content">
            <h1><perch:content id="heading" type="text" label="Single heading" markdown="true" editor="markitup" /></h1>
        </div>
    </perch:block>

    <perch:block type="anchorHeading" label="Anchored Heading" icon="pencil">
        <div class="block-Heading is-Anchored e-content">
            <perch:content id="heading_opt" type="select" label="Please select what type of heading you'd like" options="Heading one|h1, Heading two|h2, Heading three|h3, Heading four|h4, Heading five|h5" allowempty="false" suppress required>
            <perch:content id="anchor_heading" type="text" label="Heading text" encode="false">
        </div>
    </perch:block>

    <perch:block type="textblock" label="Paragraph" icon="pencil">
        <div class="block-Paragraph e-content">
            <perch:content id="postDescHTML" type="textarea" label="Large paragraph field" markdown="true" editor="markitup" size="l autowidth" />
        </div> 
    </perch:block>

    <perch:block type="textintro" label="Intro text" icon="pencil">
        <div class="block-Paragraph intro-Paragraph e-content">
            <perch:content id="introText" type="textarea" label="Great for use with your first paragraph" markdown="true" editor="markitup" size="xl autowidth" />
        </div> 
    </perch:block>

    <perch:block type="embed" label="Embed" icon="code">
        <div class="block-Paragraph is-Embed e-content">
            <perch:content id="embed_code" type="textarea" label="Paste your embed code here" html="true" size="xl autowidth" />
        </div> 
    </perch:block>

</perch:blocks>
Mathew Doidge

Mathew Doidge 2 points

  • 2 months ago
Drew McLellan

Drew McLellan 2617 points
Perch Support

Have you tried breaking it down to isolate the problem? This doesn't sound like a very sensible architecture, but I'd still expect it to function.

Drew McLellan said:

Have you tried breaking it down to isolate the problem? This doesn't sound like a very sensible architecture, but I'd still expect it to function.

Do you mean the way in which I am using blocks are my template in general?

I have stripped the template down and the block template as well and have not been able to find anything apart from the image fields that cause the issue. I may try deleting my region and creating it again.

After spending all weekend looking at the cause the only thing I can notice as a constant is this. With only a single block in my blocks template, which a textarea field - used in conjunction with my image field, the problem persists. I complete the fields like so:

  1. Title
  2. Image
  3. Text block(1)
  4. Text block(2)
  5. Save

In this scenario only text block 2 is being saved and appearing on the page reload. The same happens if I add three blocks, only block 2 is present after save.

I've stripped my core fields into their own template away from my HTML and it looks like:

<perch:content id="serv_image" type="image" label="Service Image" crop width="1600" height="600">
<perch:content id="serv_name" type="text" label="Service title" required>
<perch:content id="slug" type="slug" for="serv_name" editable indelible="true" label="Slug" help="Sets the URL in the address bar" suppress>
<perch:content id="is_featured" type="checkbox" label="Is this service featured?" help="Featured will output the service on the homepage" value="featured" suppress>
<perch:template path="content/service_blocks.html" rescope="parent">
<perch:content id="serv_image" type="image" label="Service Image" width="900" height="600" crop suppress>

Hi Drew,

I've just looked and I am actually getting an error in the console from one of the core js files. I only thought to look after I noticed once I used my image field, that the markup buttons were not appearing on my textarea block, whereas if I don't use the image field, they appear fine.

TypeError: e is undefined[Learn More] 10.10.6738d5d5f5664f7c5e34.js:1:1

I've tried reinstalling my core. I will attempt to do so again.

Drew McLellan

Drew McLellan 2617 points
Perch Support

Could you post your diagnostics?

Drew McLellan said:

Could you post your diagnostics?

Sure:


Perch: 3.1.2 Production mode: (PERCH_DEVELOPMENT) Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_forms (1.12), perch_mailchimp (3.1) DB driver: PDO DB tables: perch3_categories (5), perch3_category_counts (0), perch3_category_sets (2), perch3_content_index (995), perch3_content_items (178), perch3_content_regions (19), perch3_forms (3), perch3_forms_responses (13), perch3_menu_items (10), perch3_navigation (2), perch3_navigation_pages (17), perch3_page_templates (8), perch3_pages (11), perch3_resource_log (221), perch3_resource_tags (0), perch3_resources (29), perch3_resources_to_tags (0), perch3_settings (13), perch3_user_passwords (1), perch3_user_privileges (33), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (2) Users: 2 App runtimes: <?php $apps_list = [ 'content', 'perch_forms', 'perch_mailchimp', ]; Scheduled tasks for perch_mailchimp: import_data (1 mins) Editor plug-ins: H1: 421aa90e079fa326b6494f812ad13e79 L1: ff24192efda8ccf93f01d48766271d9d F1: 3b606135b33e6a102526838f4152a807 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 0 content_collapseList: 1 lang: en-gb installedAt: 3.0.9 update_3.0.9: done latest_version: on_sale_version: 3.1.2 update_3.1.2: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_SITEPATH: /var/www/html PERCH_DB_USERNAME: XXXX PERCH_DB_SERVER: db PERCH_DB_DATABASE: db_educationltd PERCH_DB_PREFIX: perch3_ PERCH_PRODUCTION_MODE: PERCH_DEVELOPMENT PERCH_FEATHERS: 1 PERCH_DEBUG: 1 PERCH_TZ: UTC PERCH_EMAIL_FROM: XXXX PERCH_EMAIL_FROM_NAME: XXXX PERCH_LOGINPATH: /perch PERCH_PATH: /var/www/html/perch PERCH_CORE: /var/www/html/perch/core PERCH_RESFILEPATH: /var/www/html/perch/resources PERCH_RESPATH: /perch/resources PERCH_TEMPLATE_FILTERS: 1 PERCH_IMAGE_LIB: imagick PERCH_HTML5: 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_ASSET_VERSION: 6738d5d5f5664f7c5e34 PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: /var/www/html/perch/templates PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_XHTML_MARKUP: PERCH_RWD: 1 PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_PARANOID: PERCH_FORCE_SECURE_COOKIES: PERCH_DEFAULT_BUCKET: default PERCH_TRANSLATION_ASSIST: PERCH_PASSWORD_MIN_LENGTH: 6 PERCH_MAX_FAILED_LOGINS: 10 PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR PERCH_VERIFY_UPLOADS: PERCH_PRIV_ASSIST: PERCH_CUSTOM_EDITOR_CONFIGS: PERCH_ENABLE_EXIF: 1 PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: PERCH_APPS_EDITOR_PLUGIN: markitup PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown Hosting settings PHP: 7.1.3 Zend: 3.1.0 OS: Linux SAPI: apache2handler Safe mode: not detected MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $ MySQL server: 5.7.17 Free disk space: 258.40 GB Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, session, posix, Reflection, standard, SimpleXML, pdo_sqlite, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, gd, imagick, pdo_mysql GD: Yes ImageMagick: Yes PHP max upload size: 12M PHP max form post size: 24M PHP memory limit: 128M Total max uploadable file size: 12M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No HTTP_HOST: localhost HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:62.0) Gecko/20100101 Firefox/62.0 HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_LANGUAGE: en-GB,en;q=0.5 HTTP_ACCEPT_ENCODING: gzip, deflate HTTP_REFERER: http://localhost/perch/core/settings/diagnostics/add-ons/ HTTP_COOKIE: cmsa=1; PHPSESSID=f64784d1e4311a5bca97b104c43d19a8 HTTP_CONNECTION: keep-alive HTTP_UPGRADE_INSECURE_REQUESTS: 1 PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin SERVER_SIGNATURE: <address>Apache/2.4.10 (Debian) Server at localhost Port 80</address> SERVER_SOFTWARE: Apache/2.4.10 (Debian) SERVER_NAME: localhost SERVER_ADDR: 172.20.0.3 SERVER_PORT: 80 REMOTE_ADDR: 172.20.0.1 DOCUMENT_ROOT: /var/www/html REQUEST_SCHEME: http CONTEXT_DOCUMENT_ROOT: /var/www/html SERVER_ADMIN: webmaster@localhost SCRIPT_FILENAME: /var/www/html/perch/core/settings/diagnostics/index.php REMOTE_PORT: 54590 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: 1537213448.898 REQUEST_TIME: 1537213448 argc: 1

Hi Drew,

Just an update to this. I've rolled back to Perch 3.0.10 and it's working again so for now I will just leave the site at this older version.