Joomla component does not appear in menu item types

I just followed the Joomla tutorials on how to create the “perfect” joomla MVC component. However, my problem is that I do not yet know how to assign it to the menu. I thought that my component would just display when I select "menu item type", but my component is not on this list. I did some research on Google, but I can not find the answer ... Should I create a metadata.xml file or something like that? Thank you in advance for your answers!

+5
source share
5 answers

To create “views” for your component, you need to create several XML files. Inside the templates folder on the outside of your component (usually something like / components / com_yourcomponent / views / someview / tmpl ), if you have a template named "default.php" and "form.php", you can create a file " default.xml "and the file" form.xml "so that these menu items are accessible to the administrator. You can take a look at other components to see the structure of these xml files, but what you should put inside is:

1) 2) , ( /) 3) "" . , vars , .

(Joomla 1.7):

<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="COM_AGMTAGS_TAG_VIEW_DEFAULT_TITLE">
       <message>COM_AGMTAGS_TAG_VIEW_DEFAULT_DESC</message>
    </layout>
<fields name="request" addfieldpath="/administrator/components/com_agmtags/models/fields">
    <fieldset name="request">
       <field name="tag_id" type="agmtag"
        label="COM_AGMTAGS_TAG_FIELD_NAME_LABEL"
        description="COM_AGMTAGS_TAG_FIELD_NAME_DESC"
       />
    </fieldset>
</fields>
<fields name="params">
    <fieldset name="basic" label="COM_AGMTAGS_TAG_OPTIONS">
       <field name="layout_type" type="hidden" default="blog" />
   <field name="show_tag_name" type="list"
        label="COM_AGMTAGS_SHOW_TAG_NAME"
        description="COM_AGMTAGS_SHOW_TAG_NAME_DESC"
       >
          <option value="">JGLOBAL_USE_GLOBAL</option>
          <option value="0">JHIDE</option>
          <option value="1">JSHOW</option>
       </field>
       <field name="show_tag_description" type="list"
        description="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_DESC"
        label="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_LABEL"
       >
          <option value="">JGLOBAL_USE_GLOBAL</option>
          <option value="0">JHIDE</option>
          <option value="1">JSHOW</option>
       </field>
       <field name="items_per_page" type="text" default="" />
       <field name="container_class" type="text" default="agmtags-list" />
    </fieldset>
</fields>
</metadata>

, !

+5

, xml default.xml com_yourcomponent/views/yourviewname/tmpl/

xml ,

<?xml version="1.0" encoding="utf-8"?>
<metadata>
    <layout title="COM_YOURCOMPONENT_FRONPAGE_TITLE">
       <message>COM_YOURCOMPONENT_FRONPAGE_MSG</message>
    </layout>
</metadata>

,

+3

-, XML. http://forum.joomla.org/viewtopic.php?p=706714

<administration>
    <menu>COM_COMPONET</menu>
    <submenu>
              etc...
    </submenu>

,

+1

In addition, there is another catch. In the component XML installation file, the tags should be present in the section, even if you do not need a menu.

If they are missing, you will never be given the opportunity to add this component to the menu item, because the type will not be there :-)

0
source

In addition, your alternate view file names SHOULD NOT be spelled with underscores.

table_catalog.xml
table_catalog.php
table_catalog_item.php

did not work - in the menu "Type of menu item" was not new. But

tablecatalog.xml
tablecatalog.php
tablecatalog_item.php

file names work fine. I lost an hour showing the problem.

0
source

All Articles