Forum

Thread tagged as: Problem, Error

Error in Perch after upgrading

Hi,

I have recently updated PHP and other things on a client's server as well as their version of Perch and now I am receiving the following error when trying to pass variables into a template. They have other sites (exact same code but themed) on the same server using an old version of Perch and these are working correctly still, so the problem seems version related.

The error is


Debug Message [4] SELECT regionKey, regionHTML FROM perch2_content_regions WHERE regionPage='/apply.php' OR regionPage='*' ORDER BY regionPage DESC [nil] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Application Form' AND (regionPage='/apply.php' OR regionPage='*') No matching content regions found. Check region name (Application Form) and page path options. [nil] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch2_content_index idx JOIN perch2_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch2_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE idx.regionID IS NULL AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval ORDER BY sortval ASC Using template: /templates/content/application_form.html

and the offending region in the template looks like


<?php PerchSystem::set_var('activeJob', $_GET['job']); PerchSystem::set_var('location', $_GET['subregion']); perch_content_custom('Application Form', array( 'template'=>'application_form.html' )); ?>

I've checked in the DB using the following SQL


SELECT * FROM `perch2_content_regions` WHERE regionPage = "/apply.php"

and the content region is there with what looks like the appropriate HTML.

Finally my diagnostics


HEALTH CHECK Perch is up to date PHP 5.5.9-1ubuntu4.14 is up to date MySQL 5.5.47-0ubuntu0.14.04.1 is up to date Image processing available SUMMARY INFORMATION Perch: 2.8.29, PHP: 5.5.9-1ubuntu4.14, MySQL: 5.5.47, with PDO Server OS: Linux, apache2handler Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_forms (1.8.3) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', ); PERCH_LOGINPATH: /perch PERCH_PATH: /var/www/<mysite>/perch PERCH_CORE: /var/www/<mysite>/perch/core PERCH_RESFILEPATH: /var/www/<mysite>/perch/resources Image manipulation: GD PHP limits: Max upload 20M, Max POST 8M, Memory: 128M, Total max file upload: 8M F1: 2edba60ed1f613d6dd804feb202456a2 Resource folder writeable: Yes HTTP_HOST: <mysite>.co.uk DOCUMENT_ROOT: /var/www/<mysite> REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Many thanks

Lee

Lee Goodman

Lee Goodman 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What does this return?

SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='Application Form' AND (regionPage='/apply.php' OR regionPage='*')

The debug indicates that there are no matching rows.

Hi Drew,

I get zero results from this query, this is a replica of another site though, any thoughts on what to do next?

Cheers

Drew McLellan

Drew McLellan 2638 points
Perch Support

So it looks like the region doesn't exist. Can you see it in the control panel?

Hi Drew,

No the region does not show up on the page in the CMS, but I was under the impression that this code would generate the region?

<?php     
    PerchSystem::set_var('activeJob', $_GET['job']);
    PerchSystem::set_var('location', $_GET['subregion']);

    perch_content_custom('Application Form', array(
        'template'=>'application_form.html'
    ));    
?>

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_content_custom() will not create a region. You need to use perch_content() or perch_content_create() to create a region.