【问题标题】:Strict Standards: Non-static method Error in Joomla严格标准:Joomla 中的非静态方法错误
【发布时间】:2023-03-31 18:50:02
【问题描述】:

我开发了一个 Joomla 组件。在管理员部分中,我使用helper/select.php 文件显示动态类别。但是我收到了这个错误:

严格标准:不应静态调用非静态方法 TrueMatrimonyHelperSelect::getProfileforlist(),假设 $this 来自不兼容的上下文

XML 代码:

<field name="createby" type="list" id="createby"     	               
    source_file="admin://components/com_astrimony/helpers/select.php"
    source_class="TrueMatrimonyHelperSelect" source_method="getProfileforlist"
    sortable="true" tdwidth="15%" show_link="true" url="index.php?option=astrimony&amp;view=profile&amp;id=[ITEM:ID]"
    label="COM_MATRIMONY_REGISTER_FOR"	
/>

选择文件代码

public function getProfileforlist($name='', $attr=array(), $selected_value='', $id='') {                
        $items = FOFModel::getTmpInstance('Profilerefers', 'TrueMatrimonyModel')->enabled(1)->getList(true);        
        $result = array();      
        $result[] = JHtml::_('select.option','',JText::_('COM_TRUEMATRIMONY_SELECT_PROFILE_FOR'));
        foreach($items as $item) {
            $result[$item->profilerefer_id] = $item->profile_reference;
        }   //print_r($result);exit;        
        return $result;
    }

【问题讨论】:

标签: php joomla components joomla3.0 joomla-extensions


【解决方案1】:

public function getProfileforlist 替换为public static function getProfileforlist

【讨论】:

    猜你喜欢
    • 2013-05-08
    • 2013-03-31
    • 2015-05-08
    • 2013-01-08
    • 2013-09-15
    • 2011-06-08
    • 1970-01-01
    相关资源
    最近更新 更多