Thread tagged as: Problem, Error, Runway

Perch Categories Function Failure


I'm running Perch Runway 3.0.8:

    Perch Runway: 3.0.8, PHP: 5.4.13, MySQL: 5.5.30, with PDO
    Server OS: Linux, apache2handler
    Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.5.1), lda_auction (0.1), perch_members (1.6.1)
    App runtimes: <?php $apps_list = array( 'perch_members', 'perch_blog', 'lda_auction', );
    PERCH_RESFILEPATH: /var/www/vhosts/...[removed for client confidentiality]
    PERCH_PATH: /var/www/vhosts/...[removed for client confidentiality]
    PERCH_CORE: /var/www/vhosts/...[removed for client confidentiality]
    Image manipulation: GD
    PHP limits: Max upload 256M, Max POST 256M, Memory: 512M, Total max file upload: 256M
    F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
    Resource folder writeable: Yes
    DOCUMENT_ROOT: /var/www/vhosts/...[removed for client confidentiality]
    REQUEST_URI: /admin/core/settings/diagnostics/
    SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

I'm wanting to get all the Category records for a particular set called 'Venue', so I'm running this:

$categories = perch_categories([
  'skip-template'=> true,          

It fails and I get:

Fatal error: Call to undefined function perch_categories() in /var/www/vhosts/

This is part of a bespoke app - but not sure that should cause this problem. Any ideas?

Jack Barber

Jack Barber 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What context is it running in? If it's not on a page (i.e. in the control panel, or elsewhere), runtime functions aren't available.

ahh... ok - that'll be it. It's running as part of a script within the app - I need to match data from a CSV to data in the Category - I think I can get around it by just doing a query on the perch3_categories table.

I guess this is a bit of a hack, is there a tidier method for accessing the category data within an app?


Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hey Jack

This may work:

$API = new PerchAPI(1.0, 'core');
$Categories = new PerchCategories_Categories($API);
$categories = $Categories->all();