Forum

Thread tagged as: Problem, Error

Redisplaying snippets from another page

Hi,

I have a page which contains news and offers:- https://www.feelgood-factor.co.uk/newsoffersfgfwithcms.html

Here is the template for the capture of the Latest Offers section:-

<li class="">
<h4>
 <perch:content id="monthheading" type="text" label="Offer Heading" textile="true" editor="markitup" maxlength="150"  />
</h4>  
</li>
<li class=""><perch:content id="monthtext" type="text" label="Offer Text" textile="true" editor="markitup"  /></li>
<li class="">
  <div class="separator"></div>
</li>

I want to display snippets of the latest offers on the home page so I am trying to use perch_content_custom on page:- https://www.feelgood-factor.co.uk/indexwithcms.html

the include is this:-

 <?php
    perch_content_custom('monthoffers', array(
        'page'=>'newsoffersfgfwithcms.html',
        'template'=>'_homemonthlyoffers.html'     
    )); 
?>

and the template is this:-

<span class="dish_title"><br style=""/>

<perch:content id="monthheading" type="text" label="Offer Heading" textile="true" editor="markitup" maxlength="150"  />
</span>

<p class="dish_description">
<perch:content id="monthtext" type="text" label="Offer Text" textile="true" editor="markitup" 
</p>

Where am I going wrong?

Thanks Karen

Karen Blaylock

Karen Blaylock 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What problem are you encountering?

It isn't displaying the content see: https://www.feelgood-factor.co.uk/indexwithcms.html

I was trying for the latest two 'Latest Offers' to be displayed in the Special Offers section but nothing is being displayed.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you turn on debug for the page, what does it output?

https://docs.grabaperch.com/docs/installing-perch/configuration/debug/

define('PERCH_DEBUG', true); Fatal error: Class 'PerchUtil' not found in /homepages/3/d162072124/htdocs/fgf/perch/core/runtime/runtime.php on line 9

Rachel Andrew

Rachel Andrew 394 points
Perch Support

It sounds like you are missing files in this installation.

As far as I am aware all files uploaded successfully. Can you point me in the direction of which files in particular? Thanks Karen

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Class 'PerchUtil' not found

That's a core Perch file. I would suggest that you reupload all files to make sure.

Ok, I have replaced the core and can see perch/core/lib/PerchUtil.class.php

but am still getting the error.

define('PERCH_DEBUG', true);
Fatal error: Class 'PerchUtil' not found in /homepages/3/d162072124/htdocs/fgf/perch/core/runtime/runtime.php on line 9

This is the code from runtime.php

<?php
    define('PERCH_ERROR_MODE', 'SILENT');
      include(__DIR__.'/../inc/pre_config.php');
    include(__DIR__.'/../../config/config.php');
    if (!defined('PERCH_PRODUCTION_MODE')) define('PERCH_PRODUCTION_MODE', PERCH_PRODUCTION);
    include(PERCH_CORE . '/runtime/loader.php');
    $apps_list = array();
    include(PERCH_PATH . '/config/apps.php');
    if (PerchUtil::count($apps_list)) {
        foreach($apps_list as $app_id) {
            switch($app_id) {
                case 'content':    include(PERCH_PATH.'/core/apps/content/runtime.php'); break;
                case 'assets':     include(PERCH_PATH.'/core/apps/assets/runtime.php'); break;
                case 'categories': include(PERCH_PATH.'/core/apps/categories/runtime.php'); break;
                default:           include(PERCH_PATH.'/addons/apps/'.$app_id.'/runtime.php');
            }
        }
    }
    include(PERCH_PATH . '/core/inc/forms.php');

    if (file_exists(PERCH_PATH . '/config/feathers.php')){
      include(PERCH_PATH . '/config/feathers.php');
      include(PERCH_PATH . '/core/inc/feathers.php');
    }

Don't know if it's a red herring but something I am not sure of is why the debug path contains reference to the umbrella folders containing various websites not just the one with an error on i.e.

 /homepages/3/d162072124/htdocs/fgf/perch/core/runtime/runtime.php

The hosting points to folder fgf for this website whereas /homepages/3/d162072124/htdocs references higher folders outside of the website hosting folder for that website.

Any advise? Karen

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you seeing the string define('PERCH_DEBUG', true); on your page?

this is what is displayed on the page:- define('PERCH_DEBUG', true); Fatal error: Class 'PerchUtil' not found in /homepages/3/d162072124/htdocs/fgf/perch/core/runtime/runtime.php on line 9

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Did you put that in your config file? Is it outside PHP tags?

Hi I can only say this code:

define('PERCH_DEBUG', true);

is (the only code) in file config.php which has been uploaded to

perch/config

Is this what you mean?

I put PHP tags around <?php define('PERCH_DEBUG', true); ?>

the output from my page is

Fatal error: Class 'PerchUtil' not found in /homepages/3/d162072124/htdocs/fgf/perch/core/runtime/runtime.php on line 9

Drew McLellan

Drew McLellan 2638 points
Perch Support

If your config file is otherwise empty, it sounds like you've not installed Perch yet.

I am not sure what has happened as a previously working perch page is now 'broken'. I will reinstall all perch files as previously suggested and see what happens. Thanks Karen

Drew McLellan

Drew McLellan 2638 points
Perch Support

Or just restore your config.php from your backup.

Yes, I had overwritten my config.php file and now all back as it was, so now I am getting debug:-

DIAGNOSTICS:
SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch2_content_regions WHERE regionKey='monthoffers' AND (regionPage='newsoffersfgfwithcms.html' OR regionPage='*')
No matching content regions found. Check region name (monthoffers) and page path options.
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 ORDER BY sortval ASC
Using template: /templates/content/_homemonthlyoffers.html

So let's get back to what is wrong with the code please.

Thanks Karen

Drew McLellan

Drew McLellan 2638 points
Perch Support

"No matching content regions found. Check region name (monthoffers) and page path options."

Hi,

I didn't realise the page path would need a '/' before it, it now seems to be working OK.

Thanks for your help Karen