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: Question, Problem

Perch If Else not working

I struggling to get this working, am I doing something wrong? I've create a really simple example from the perch website but still cant get it to work.

When I add the name it displays Author unknown and when I remove the name it displays nothing.

<perch:if exists="name">
     <p><perch:content id="name" type="text" label="Name"></p>
 <perch:else>
     Author unknown
</perch:if>
David Lee

David Lee 0 points

  • 1 year ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Please post your Diagnostics Report.

Sorry, here it is

Perch: 3.0.13, PHP: 7.0.30, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_blog (5.6.1), perch_forms (1.10)
App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_forms', ];
PERCH_LOGINPATH: /admin
PERCH_PATH: /chroot/home/workprev/workpreview.co.uk/html/spurn/admin
PERCH_CORE: /chroot/home/workprev/workpreview.co.uk/html/spurn/admin/core
PERCH_RESFILEPATH: /chroot/home/workprev/workpreview.co.uk/html/spurn/admin/resources
Image manipulation: GD Imagick
PHP limits: Max upload 1000M, Max POST 1000M, Memory: 256M, Total max file upload: 256M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/
DOCUMENT_ROOT: /home/workprev/workpreview.co.uk/html
HTTP_HOST: spurn.workpreview.co.uk

Does your Perch content tag need to be self-closed?

E.g <perch:content id="name" type="text" label="Name" />

(The example in the docs is written for the latest version of Perch which doesn't need self-closing tags)

That was part of the problem, thanks for that.

Still not working correctly though, it now displays either nothing or both name and Author unknown.

I've just updated to 3.1.1 and its all working now, thanks for your help.