Forum

Thread tagged as: Question
Drew McLellan

Drew McLellan 2638 points
Perch Support

If the page is white then PHP is throwing an error. Look at your PHP error log to see what the error is.

Here's the error:

Notice: Undefined variable: out in /path/fromthemtous/perch/core/lib/PerchUtil.class.php on line 83

Notice: Undefined variable: Template in /path/fromthemtous/perch/core/lib/PerchFactory.class.php on line 620

Fatal error: Call to a member function find_all_tag_ids() on a non-object in /path/fromthemtous/perch/core/lib/PerchFactory.class.php on line 620
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, ok. That's been fixed already and so should be in today's release. Sorry for the trouble.

Great, thanks for the info!

Thanks for the fix. I get the list of categories for a particular set with:

$themes = perch_categories(array(
    'set' => 'themes',
    'skip-template' => true,
));

Now, I'd like to pull only the array of categories assigned to a particular item, in the context of a list / detail page. I'm doing something ugly for now:

// Getting the results
$getThemes = perch_content_custom('Episodes', array(
      'skip-template' => true,
      'filter' => 'slug',
      'match' => 'eq',
      'value' => perch_get('s'),
      'count' => 1
));

// Counting the number of array entries
$numThemes = count($getThemes[0]['themes']);

for($i=0; $i<$numThemes;$i++) {
    $currentTheme = $getThemes[0]['themes'][$i];

        // Setting the category path to perch_category
    $themes = perch_category($currentTheme, array(
        'skip-template' => true
    ));

    print_r($themes);
}

I believe there's a much cleaner way to do with Perch but I can't get it to filter the results for the particular slug. Something like. Could you help with the filtering part?

$themes = perch_categories(array(
    'set' => 'themes',
    'filter' => 'slug',
    'match' => 'eq',
    'value' => perch_get('s'),
    'skip-template' => true,
));

Sorry for bothering with this post, it's going on for a long time:) almost there!

Cheers,

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not ugly - it's perfectly fine. Use skip-template to get the item and you'll get an array of the assigned categories. That's how it works.