Reputation: 51064
I am writing my first Joomla component, on Joomla 3.3.0, following the book Learning Joomla! 3 Extension Development, Third Edition.
I am following the author's advice and writing code directly under Jommla's folders, such as \administrator\components\com_coup
, where com_coup
is my component for a coupon management system. I have a full folder structure, and at the end of a chapter the author says I should have a certain folder and file structure, and am ready for installation by Discovery, Joomla finds my component in Site
and Administration
, and installing the admin one seems to go well, but no menu item is inserted into the Components
menu.
Should I be discovering two components, why is my menu item not inserted. My `coup.xml' file contains the line:
<administration>
<menu img="class:categories">COM_COUP_MENU</menu>
and the text item COM_COUP_MENU
exists in the language\en-GB\en-GB.com_coup.sys.ini
file.
My coup.xml
file is:
<?xml version ="1.0" encoding ="utf-8"?>
<extension type="component" version="3.0" method="upgrade">
<name>com_coup</name>
<author>Brady Kelly</author>
<creationDate>2014-06-14</creationDate>
<copyright>(C) Erisia Web Development. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>http://thepraxis.co.za/</authorUrl>
<version>1.0.0</version>
<description>COM_COUP_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<files folder="site">
<filename>index.html</filename>
</files>
<administration>
<menu img="class:categories">COM_COUP_MENU</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>coup.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>sql</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/en-GB.com_coup.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_coup.sys.ini</language>
</languages>
</administration>
</extension>
and my en-GB.com_coup.sys.ini
file is:
COM_COUP="Coup"
COM_COUP_XML_DESCRIPTION="The winning voucher and coupon manager!"
COM_COUP_MENU="Voucher Coup"
Upvotes: 1
Views: 1337
Reputation: 9330
It could be failing in a few different places, the first thing to check is that you have error reporting set to "Development" (Global Configuration—>Server->Server Settings
) and Debug System
turned on (Global Configuration—>System->Debug Settings
), you may also want to turn on Debug Language
(it's just below Debug System
).
Stepping through process these are the steps that are happening (you don't mention any errors and a silent failure seems unusual).
When discover()
runs it loads all of the installer/adapater/
's found in /libraries/cms/
, you've said it's a component, so the component.php
adapter is the relevant one. This loops through the site and admin /components/
directories looking for each components xml file (i.e. your coup.xml
). If there was a problem in your XML file this could cause an error but it would occur before the install step which apparently you can run.
The fact that your component is found twice might be part of the problem… do you have coup.xml
in both the site's /components/com_coup
and /administrator/components/com_coup
? (Our extensions only have them in the admin side, I'd probably remove the front end one).
The adapters return an array of found items (components, modules, plugins, libraries etc) this is compared to the extensions registered in #__extensions
and any items that aren't listed are added to the extensions table with a state
of -1
. The "Discover" view then displays the list of items found so the user can select one or more of them and "Install" them.
discover_install()
basically runs a normal install (except the copy files), so it runs any install SQL
files.
Then it runs _buildAdminMenus()
to add the Admin menus where it looks to see if the extension already has a menu before over writing it.
Finally any InstallerScript
file found in the manifest is run.
Each of these stages could throw an error - but you should see an error message of some kind in that case.
I would check:
Debug Languages
is enabled.php -l /path/to/file.php
)Adding your full XML file and sys.ini
language file could also help. ini
language files can be tricky if you haven't been using the Debug Languages
option.
Upvotes: 1