Support Forums

Help with an error message.

This is a discussion on Help with an error message. within the Technical Support forums, part of the Technical Support Forums category; Hi all. I've been away for quite a while but I'm back and raring to press on with my sites. ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 09-04-2008, 11:52 AM   #1
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 474
Rep Power: 31
michael is just really nice michael is just really nice
Default Help with an error message.

Hi all. I've been away for quite a while but I'm back and raring to press on with my sites. I'm getting the following error message on some - not all - pages:
Fatal error: Call to a member function get_ids() on a non-object in /home/michael/public_html/mkclassifieds/includes/classes/smarty/plugins/function.categories_parent.php on line 38
Any ideas?
__________________
M Michael
V4.2.1 Developer - Sigma Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline  
Old 09-04-2008, 11:56 AM   #2
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 133
Eric Barnes is just really nice Eric Barnes is just really nice
Default

I think this is a bug in the plugin: includes/smarty/plugins/function.categories_parent.php

Please replace that whole file with this:
PHP Code:
<?php
/**
* @copyright 68 Classifieds
*
* @author $Author: suzkaw $
* @version $Revision: 411 $
* @package Smarty
* @subpackage plugins
*
* @Updated: $Date: 2008-08-26 10:20:49 -0400 (Tue, 26 Aug 2008) $
*/

/**
 * This function is useful for using your parent categories in the navigation
 * 
 * To Call this function in your template you would use: 
 * <code>{categories_parent}
 * {foreach from=$pcat item=entry}
 * <ul>
 * <li>{$entry.link} {$entry.total}</li>
 * </ul>
 * {/foreach}</code>
 * 
 */

/**
 * Include categories class
 */
require_once(FILESYSTEM_PATH .'includes/classes/kernel/Categories.php');

function 
smarty_function_categories_parent($params, &$smarty)
{
    global 
$db$class_tpl$arr_childs;
    
    
$show_total='N';

    foreach (
$params as $_key=>$_value
    {
        switch (
$_key
        {
            case 
'show_total':
                $
$_key = (string)$_value;
                break;
        }
    }
        
        
$Categories = new Categories;
        
$sSQL "SELECT id,name,cLink,slug FROM ".PREFIX."categories WHERE parent_id = 0 AND display<>'N' ORDER BY cORDER DESC, name ASC";
        
$result=$db->query($sSQL);
        
$i=0;
        while(
$rs=$result->fetch())
        {
            if(
$arow['cLink']<>"")
            {
                
$rs['link']='<a href="'.$rs['cLink'].'">'.$rs['name'].'</a>';
            }
            else
            {
                
$rs['link']='<a href="category.php?cat='.$rs['slug'].'">'.$rs['name'].'</a>';
            }
            if(
$show_total=='Y') {
                
$arr_childs = array($rs['id']);
                
$Categories->get_ids($arr_childs);
                
$rs['total']=$Categories->get_count($arr_childs);
            }
            
$cat[]=$rs;
        }
    
$class_tpl->assign('pcat'$cat);
}
?>
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 09-04-2008, 11:59 AM   #3
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 474
Rep Power: 31
michael is just really nice michael is just really nice
Default

That was fast Eric! Thanks I'll try that now . . . .
__________________
M Michael
V4.2.1 Developer - Sigma Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline  
Old 09-04-2008, 12:09 PM   #4
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 474
Rep Power: 31
michael is just really nice michael is just really nice
Default

Just to be sure, my path to the plugin also includes the classes folder. Is that correct?

includes/classes/smarty/plugins/function.categories_parent.php

Is that correct?
__________________
M Michael
V4.2.1 Developer - Sigma Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline  
Old 09-04-2008, 12:12 PM   #5
Just get on with it!
 
michael's Avatar
 
Join Date: Jan 2007
Location: Milton Keynes, England
Posts: 474
Rep Power: 31
michael is just really nice michael is just really nice
Default

Whatever. It works a charm.

Thanks.
__________________
M Michael
V4.2.1 Developer - Sigma Template


"All truths are easy to understand once they are discovered; the point is to discover them" - Galileo Galilei (1564 - 1642)
michael is offline  
Closed Thread

Thread Tools
Display Modes



All times are GMT -4. The time now is 12:27 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0