Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在扩展帮助Joomla中使用标记_Joomla_Tags_Custom Component - Fatal编程技术网

在扩展帮助Joomla中使用标记

在扩展帮助Joomla中使用标记,joomla,tags,custom-component,Joomla,Tags,Custom Component,我试图在我的自定义组件joomla中有一个标记字段,但我就是做不到 我已经遵循了这个指南,但仍然不能做到这一点,有人可以尝试解释多一点关于这一点 谢谢你的帮助(我很绝望:)) 我试过了,但是我有很多错误,而且我是joomla的新手,我只想在我的自定义组件中使用tag字段 编辑 所以我从这里开始,因为我不明白其余的 我加了一句: $this->_observers = new JObserverUpdater($this); JObserverMapper::attachAllObserve

我试图在我的自定义组件joomla中有一个标记字段,但我就是做不到

我已经遵循了这个指南,但仍然不能做到这一点,有人可以尝试解释多一点关于这一点

谢谢你的帮助(我很绝望:)) 我试过了,但是我有很多错误,而且我是joomla的新手,我只想在我的自定义组件中使用tag字段

编辑

所以我从这里开始,因为我不明白其余的

我加了一句:

$this->_observers = new JObserverUpdater($this); JObserverMapper::attachAllObservers($this);
致我的: admin/tables/projectinfo.php(我不知道他是否需要这样做)

代码:

2º然后:我没有,因为是为joomla 3.1.4

3º这个我觉得还可以:D

4º我什么都不懂,我只是按Ctrl-p键:

admin\views\projectinfo\view.html.php

把它放在这里:

/**
 * @package     Joomla.Administrator
 * @subpackage  com_projectinfo
 *
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
 * ProjectInfo View
 *
 * @since  0.0.1
 */
class ProjectInfoViewProjectInfo extends JViewLegacy
{
    /**
     * View form
     *
     * @var         form
     */
    protected $form = null;

    /**
     * Display the PROJECTINFO view
     *
     * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
     *
     * @return  void
     */
    public function display($tpl = null)
    {
    /*THIS LINE*/ $item->tags = new JHelperTags;
    $item->tags->getItemTags('com_projectinfo.projectinfo' , $this->item->id);/*THIS LINE*/
        JHtml::_('jquery.framework');
        $document = JFactory::getDocument();
        $document->addScript(JURI::root() . "/administrator/components/com_projectinfo"
                                          . "/models/fields/js/catch.js");
        // Get the Data
        $this->form = $this->get('Form');
        $this->item = $this->get('Item');
        $this->script = $this->get('Script');
        // Check for errors.
        if (count($errors = $this->get('Errors')))
        {
            JError::raiseError(500, implode('<br />', $errors));

            return false;
        }


        // Set the toolbar
        $this->addToolBar();

        // Display the template
        parent::display($tpl);

        // Set the document
        $this->setDocument();

        $this->item->tagLayout = new JLayoutFile('joomla.content.tags');
        echo $this->item->tagLayout->render($this->item->tags->itemTags);

    }

    /**
     * Add the page title and toolbar.
     *
     * @return  void
     *
     * @since   1.6
     */
    protected function addToolBar()
    {
        $input = JFactory::getApplication()->input;

        // Hide Joomla Administrator Main menu
        $input->set('hidemainmenu', true);

        $isNew = ($this->item->id == 0);

        if ($isNew)
        {
            $title = JText::_('COM_PROJECTINFO_MANAGER_PROJECTINFO_NEW');
        }
        else
        {
            $title = JText::_('COM_PROJECTINFO_MANAGER_PROJECTINFO_EDIT');
        }

        JToolBarHelper::title($title, 'projectinfo');
        JToolBarHelper::save('projectinfo.save');
        JToolBarHelper::cancel(
            'projectinfo.cancel',
            $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'
        );
    }
    /**
     * Method to set up the document properties
     *
     * @return void
     */
    protected function setDocument() 
    {
        $isNew = ($this->item->id < 1);
        $document = JFactory::getDocument();
        $document->setTitle($isNew ? JText::_('COM_PROJECTINFO_PROJECTINFO_CREATING') :
                JText::_('COM_PROJECTINFO_PROJECTINFO_EDITING'));
        $document->addScript(JURI::root() . $this->script);
        JText::script('COM_PROJECTINFO_PROJECTINFO_ERROR_UNACCEPTABLE');
    }

}
/**
*@package Joomla.Administrator
*@subpackage com\u projectinfo
*
*@copyright copyright(C)2005-2018开源事务公司版权所有。
*@license GNU通用公共许可证版本2或更高版本;请参阅LICENSE.txt
*/
//无法直接访问此文件
定义为(“JEXEC”)或die(“受限访问”);
/**
*投影信息视图
*
*@自0.0.1以来
*/
ProjectInfo类ProjectInfo扩展了JViewLegacy
{
/**
*视图形式
*
*@var形式
*/
受保护的$form=null;
/**
*显示PROJECTINFO视图
*
*@param string$tpl要分析的模板文件的名称;自动搜索模板路径。
*
*@返回无效
*/
公共功能显示($tpl=null)
{
/*此行*/$item->tags=新的JHELPTAGS;
$item->tags->getItemTags('com_projectinfo.projectinfo',$this->item->id);/*此行*/
JHtml::(('jquery.framework');
$document=JFactory::getDocument();
$document->addScript(JURI::root()。“/administrator/components/com\u projectinfo”
.“/models/fields/js/catch.js”);
//获取数据
$this->form=$this->get('form');
$this->item=$this->get('item');
$this->script=$this->get('script');
//检查错误。
如果(计数($errors=$this->get('errors'))
{
JError::raiseError(500,内爆(“
,$errors”); 返回false; } //设置工具栏 $this->addToolBar(); //显示模板 父::显示($tpl); //设置文档 $this->setDocument(); $this->item->tagLayout=newjlayoutfile('joomla.content.tags'); echo$this->item->tagLayout->render($this->item->tags->itemTags); } /** *添加页面标题和工具栏。 * *@返回无效 * *@自1.6 */ 受保护的函数addToolBar() { $input=JFactory::getApplication()->input; //隐藏Joomla管理员主菜单 $input->set('hidemainmenu',true); $isNew=($this->item->id==0); 如果($isNew) { $title=JText::(('COM_PROJECTINFO_MANAGER_PROJECTINFO_NEW'); } 其他的 { $title=JText::(('COM_PROJECTINFO_MANAGER_PROJECTINFO_EDIT'); } JToolBarHelper::title($title,'projectinfo'); JToolBarHelper::save('projectinfo.save'); JToolBarHelper::取消( 'projectinfo.cancel', $isNew?'JTOOLBAR\u CANCEL':'JTOOLBAR\u CLOSE' ); } /** *方法来设置文档属性 * *@返回无效 */ 受保护的函数setDocument() { $isNew=($this->item->id<1); $document=JFactory::getDocument(); $document->setTitle($isNew?JText::\('COM\u PROJECTINFO\u PROJECTINFO\u CREATING'): JText::((“COM_PROJECTINFO_PROJECTINFO_EDITING”); $document->addScript(JURI::root().$this->script); JText::script('COM_PROJECTINFO_PROJECTINFO_ERROR_acceptable'); } }
在这之后,我非常困惑,犯了很多错误,我退出了,最后一个错误是:

警告:从第35行的C:\xampp\htdocs\Joomla_3.8.7-Stable-Full_Package\administrator\components\com\u projectinfo\views\projectinfo\view.html.php中的空值创建默认对象

注意:未定义的属性:projectinfo\htdocs\Joomla\u 3.8.7-Stable-Full\u Package\administrator\components\com\u projectinfo\views\projectinfo\view.html.php中的$item,第36行

注意:尝试获取C:\xampp\htdocs\Joomla_3.8.7-Stable-Full_Package\administrator\components\com_projectinfo\views\projectinfo\view.html.php第36行中非对象的属性“id”


ty

发布一些您尝试过的代码,以及在实施过程中遇到的问题。好的,请稍等:D@raVan96完成后,我编辑了问题是的,正在查看,很快就会回来:)问题是您想在Joomla表单中使用标记字段,还是需要在组件中使用标记系统。所以这两件事是不同的