JHTML クラスの追加
たとえば下記のようにしたい場合。
echo JHTML::_('mycomponent.content.link', $id, $title);
まずはどこかで次のようにクラスパスを追加。
JHtml::addIncludePath(JPATH_COMPONENT.'/html');
JHTML クラスは JPATH_COMPONENT/html/content.php として次のように登録
/** * マイコンテンツ関連HTML出力クラス */ class MyComponentContent { /** * コンテンツへのリンクを表示 * @param int id * @param string title * @return string */ function link($id, $title) { $attributes = array(); $attributes['href'] = JRoute::_('index.php?option=com_mycomponent&view=content'); $attributes['id'] = $id; $attributes = JArrayHelper::toString($attributes); return "<a {$attributes}>{$title}</a>"; } }