Forum

Thread tagged as: Problem, Runway, Blog

Perch Blog - Blocks

Hi,

My issue is the same as some other people have reported, but as there is currently no solution, I wanted to post my version of events as the multiple occurences seem to suggest a bug.

Having managed to get the Blog App working in Runway, I wanted to start utilising the ability to operate multiple blogs. This has proved slightly tricky, but now I understand what is happening and how things work a little better.

This has culminated in the use of a new template for my second 'Blog' named 'News'.

As such, I have created a new 'news_post.html' template, that can be selected from the dropdown when adding a new post.

This new template contains blocks. I have used these within this installation succesfully, but as soon as I add them to a blog template, they fail.

I am observing the same effect as other people have mentioned, which is, when I add a block to the post, all I see initially is a grey bar where the block content should be and the block id written on it. Uneditable and no functionality displayed.

As soon as I save the entry, be it Draft or Published, the actual Block 'content' appears. By block content I mean elements such as a text box, or textarea with editor......

Even if I strip the template down to only contain a single block, the issue is still there.

I have not tried this on the live version of the site, but as people have reported, it has made no difference in the past.

It would be great to hear from somebody who HAS got blocks working on a blog template. Has anyone got this working.

Sadly for the implementation the client wants, I really need this to work.

Thanks,

Andy


Perch Runway: 3.0.2, PHP: 7.0.4, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: f59eb767fe17a6679589b5c076d9fa88d3d4eac0 $, with PDO Server OS: WINNT, apache2handler Installed apps: content (3.0.2), assets (3.0.2), categories (3.0.2), perch_blog (5.5.1) App runtimes: <?php $apps_list = [ 'perch_blog' ]; PERCH_LOGINPATH: /admin PERCH_PATH: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin PERCH_CORE: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin\core PERCH_RESFILEPATH: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin\resources Image manipulation: GD PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: Yes HTTP_HOST: auk.kdl DOCUMENT_ROOT: C:/KDL-Projects/Open/kdl_anticoagulation/www REQUEST_URI: /admin/core/settings/diagnostics/ SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Andrew Kennedy

Andrew Kennedy 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

So the problem is solved as soon as you save?

Yes, as soon as I save it, then the block elements appear.

Forgot to say, but also after the first save, any subsequent blocks that are added appear normally.

Really odd behaviour.

So, everytime I create a new post using this template the initial block(s) are not displayed properly until 'save' is clicked.

Ok for sanity, and I thought I had already completed this test, but I also looked at putting 'blocks' in the normal post.html template (rather than a sub template) and they appear !!!

So, it seems that blocks only have a problem when you are using them within a blog sub-template, i.e. an alternate post template held within:

../admin/templates/blog/posts

Maybe this is the clue we have been waiting for ?????

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

A sub template or an alternative post template?

An alternative post template.

Apologies, I was just trying to think of a way to describe the template, hence why I put in it's location, i.e. '../admin/templates/blog/posts', so you could see that my new template 'news_post.html' lives within this directory and is being called rather than the standard blog post.html template.

Thanks.

Interesting that the blocks worked in the post.html template, one directory further up the structure ?

Is it a location issue, where the block calls do not understand the path to this 'blog/posts/' directory ?

Just a thought.

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, the edit page doesn't really care where the template file comes from. It's more likely a JavaScript issue.

Ok, hopefully it can get resolved.

Thanks for the update.

Any news on this issue ?

Has anyone else resolved it ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us the template you're using?

Of course.

<perch:blog id="mediaType" type="select" label="Select Media Type:" options="News|news, Event|event" allowempty="false" required="true" suppress="true"  />
<time class="dt-published" datetime="<perch:blog id="postDateTime" type="date" label="Date" time="true" format="Y-m-d H:i:s" divider-before="Publishing" />">
            <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" suppress="true" /> 
</time>     
<header>
            <div class="container">
                <div class="row">
                    <div class="col-md-8 col-md-offset-2 text-center">
                        <h1 class="x-large block pt-medium pb-medium">
                            <perch:blog id="postTitle" type="text" label="Title" size="xl autowidth" />
                        </h1>
                        <p><perch:blog id="postDateTime" format="%d %B %Y" /></p>
                    </div>
                </div>                  
            </div>
        </header>



<perch:blocks>

        <!-- TITLE BLOCK -->
        <perch:block type="mediaTitle" label="Post Title:">
            <section class="page-content">
                <div class="container">
                    <div class="row">
                        <div class="col-md-8 col-md-offset-2 text-center">
                            <h1 class="x-large block pt-medium pb-medium">
                                <perch:blog id="mediaTitleID" type="text" size="m" label="Title:" />
                            </h1>
                        </div>
                    </div>                  
                </div>
            </section>
        </perch:block>

        <!-- LEAD BLOCK -->
        <perch:block type="mediaLead" label="Lead Block">
            <section class="page-content">
                <div class="container">
                    <div class="row">
                        <div class="col-md-10 col-md-offset-1 text-left lead">
                            <perch:blog id="mediaLead" type="textarea" label="Lead:" editor="redactorcustom" html="true" size="m" />
                        </div>
                    </div>
                </div>
            </section>
        </perch:block>  

        <!-- TEXT BLOCK -->
        <perch:block type="mediaText" label="Text Block">
            <section class="page-content">
                <div class="container">
                    <div class="row">
                        <div class="col-md-8 col-md-offset-2 text-left test">
                            <perch:blog id="mediaText" type="textarea" label="Text Block:" editor="redactorcustom" html="true" size="m" />
                        </div>
                    </div>
                </div>
            </section>
        </perch:block>

        <!-- INLINE IMAGE -->
        <perch:block type="mediaImage" label="Inline Image:">
            <section class="page-content">
                <div class="container">
                    <div class="row">
                        <div class="post-pic col-md-8 <perch:blog id="mediaClass" type="select" options="Pull left|col-md-offset-1,Pull right|col-md-offset-3" label="Image Alignment:" order="2" />">
                            <img src="<perch:blog id="mediaImage" type="image" density="2" label="Inline Image:" order="1" />" class="responsive" />
                        </div>
                    </div>
                </div>
            </section>
        </perch:block>


</perch:blocks>

<perch:if exists="authorGivenName">
            by <span class="p-author h-card"><perch:blog id="authorGivenName" type="hidden" /> <perch:blog id="authorFamilyName" type="hidden" /></span>
        </perch:if>    

<!-- NEED TO CHANGE THE SET TO REFLECT THE CATEGORY SET I WANT SPECIFIC FOR THE BLOG -->
        <perch:categories id="categories-news" set="news" label="News Categories" display-as="checkboxes">
            <a href="archive.php?cat=<perch:category id="catSlug" type="slug" />" class="p-category">
                <perch:category id="catTitle" type="text" />
            </a>
        </perch:categories>

        <perch:blog id="homeImage" Label="Home Page Image:" type="image" width="350" crop="true" suppress="true" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which part is not displaying as you expected?

All of the blocks element.

This template fails to render each block element correctly, until the entry is saved. For example, if I add a textarea, only a grey bar with the ide of the block appears. Press 'Save' and the textbox and wysiwyg editor appears.

Happens for all items.

The template works fine when it is in the blog directory, but when it is saved as an alternative post template within the posts directory, it fails.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, we'll try again to reproduce it.

So, you have working blocks in a 'multiple' blog, where the template is held within the 'post' sub-directory.

Ok, maybe it's something to do with the set-up then. I know other people have suffered this issue.

Thanks for your persistence in trying to get to the bottom of it.

Would be interesting to hear if you set-up a new blog named news and tried to run the above template as an alternative blog template.

Again, it's odd that the template works fine when at the same level as post.html, but as soon as it is moved to the 'posts' directory location for alternative post templates it fails.

Any update concerning this. Have you got a working example Drew ? of working blocks in a 'multiple' blog, where the template is held within the 'post' sub-directory.

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, I've not looked at it yet.