【发布时间】: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&view=profile&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