0
을 개발,줌라 구성 요소 범주는
하지만 난 아무것도에 대한 프론트 엔드를 만들 보지 않았다 내가 새보기 "범주"를 추가하므로 카테고리보기, 여기에 내 코드 : 관리자의
폴더 필드
, 난은 HelloWorld와 동일한 hellocategory.php 대부분의 코드를 생성, 단지 변경protected $type = 'HelloCategory';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// custom
$query->select('#__categories.id as id,#__categories.title as category,#__categories.extension as exten');
$query->from('#__categories');
$query->where($db->quoteName('extension') . ' LIKE '. $db->quote('com_helloworld'));
// end custom
$db->setQuery((string) $query);
$messages = $db->loadObjectList();
$options = array();
view.html.php
class HelloWorldViewCategory extends JViewLegacy
{
/**
* Display the Hello World view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{
// Assign data to the view
$category = $this->get('Item');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JLog::add(implode('<br />', $errors), JLog::WARNING, 'jerror');
return false;
}
// Display the view
parent::display($tpl);
}
}
default.xml에
<layout title="Category">
<message>category</message>
</layout>
<fields
name="request"
addfieldpath="/administrator/components/com_helloworld/models/fields"
>
<fieldset name="request">
<field
name="id"
type="hellocategory"
label="COM_UNOFD_UNOFD_FIELD_GREETING_LABEL"
description="COM_UNOFD_UNOFD_FIELD_GREETING_DESC"
/>
</fieldset>
</fields>
default.php
<?php var_dump($category); ?>
아무것도 출력, 카테고리 문서 나 샘플을 만들에 대해 아무것도가 온라인? 나는 솔루션을 사흘 동안 구글을 시도했지만 여전히 아이디어가 없거나 유일한 w ay가 데이터베이스에서 데이터를 가져 오는 중입니까?