Forum

Thread tagged as: Problem

Republish problem with unfilled regions

Republishing a site with unfilled regions will cause these unfilled regions to appear on the frontend

Masterpage with sometimes unused regions
My default masterpage contains regions that on some pages are not used. So in the admin screen you see a couple of used region (e.g. items = 4) and a couple of unused items (items = 0).

These regions with items=0 are not visible on the frontend website (at first).

Republishing creates visible empty items in unused regions
When I press 'republish' in the admin the item count for the unused regions is still 0. But on the website these items are shown as present (while being empty, having no data)
So now I have to go through every page and press delete for these empty items.

Questions
Is this expected and normal behaviour?
Should I look for some setting somewhere to stop this behaviour?
Should I use 'if exist' in the templates of all the regions to prevent this?

I haven added a short diagnostic report below.

Thx, René

René Banus

René Banus 0 points

  • 2 years ago
Perch: 3.1.2, PHP: 7.1.5, MySQL: 5.0.83, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_forms (1.12)
App runtimes: <?php $apps_list = [ 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /usr/local/pem/vhosts/102176/webspace/httpsdocs/perch
PERCH_CORE: /usr/local/pem/vhosts/102176/webspace/httpsdocs/perch/core
PERCH_RESFILEPATH: /usr/local/pem/vhosts/102176/webspace/httpsdocs/perch/resources
Image manipulation: GD
PHP limits: Max upload 128M, Max POST 32M, Memory: 256M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: www.centrumderond.nl
DOCUMENT_ROOT: /usr/local/pem/vhosts/102176/webspace/httpsdocs
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

As I understand it, your empty regions are outputting their markup but no data. In that case, I think I would be using `<perch:if exists=""> to prevent this.

I have investigated the problem further and found a workaround

I have tried inserting more 'if exists' and also deleting rows from the template to make it more basic. This didn't bring me a solution.
I have found a workaround, but its fragile.

Problem
If I populate an empty region first,
then delete the items so the region is empty (items=0) again,
then republish all pages:
An empty item from this empty region is presented on the frontend.

Deleting this empty item from the empty region will solve this,
only until the next 'Republish all pages'.

Solution
If I delete the empty region from the page, then 'Republish all pages',
the region will return in the admin pages,
but
1. the empty item is not showing up on the frontend, and
2. After a 'Republish all pages', no items from this empty region are showing up on the frontend.

in detail: I follow these steps

Recreating the problem
- I have an empty region. Its defined in a (referenced) master page. In my case, its the last one in a list of populated regions.
- I create a first item in this region. All is well: I see this item appear on the frontend
- I delete the item from the region. The region is again empty: 0 items. It is not showing up on the frontend.

  • I do a 'Republish all pages'. The problem is showing itself:
  • An empty item from the empty Region is showing up on the frontend.

Fixing the problem
- I delete the empty region from the page.
- I do a 'Republish all pages'
- Because the page is using the master pages, the region re appears which is ok. The empty items in this Region will not show up anymore after a 'Republish all pages'. That is: as long as the client doesn't add and then deletes all items from this Region & doesn't issue a 'Republish all pages' afterwards.

I've not seen the problem you describe. However, I think I would be using more than one master page if some regions are not being used. Perhaps I've misunderstood but is there a reason why that wouldn't work?