I've been reading over Joomla development documentation for awhile, but haven't picked up as much as I would like. What I'm trying to accomplish seems very simple on the surface, but navigating the Joomla framework is quite a challenge.

I'm curious how difficult it would be, or if it's even possible, to create a plugin that can add an additional menu item to a component. This menu item would either just be a link that would simply export a custom database query I made for this component into CSV, or it would display a view that would possibly have a button to do this.

Can a plugin be used in this capacity? Specifically, can a plugin even add menu items to a component? (I feel like I've seen this happen before with plugins I've downloaded).

If so, can a plugin access the "model" of a component and create a custom sql query to pull the specific combination of database fields I'm seeking to retrieve from that component's database tables?

Is what I'm trying to accomplish better accomplished another way (component override maybe)?

Sorry if I sound like a complete novice. My Joomla development so far has been handicapped by using cheats like the component called "Jumi", which let's you embed PHP code directly into your Joomla articles. However, I would really like to learn how to do things the right way using the Joomla developer framework.


1 Answer 1


Creating an admin menu item can done via any extension type (plugins, components, modules, etc) because you can do it as part of an "install script" (which any extension type can include).

The key thing to note here is that you create the menu item by adding a row to the #__menus database when you first install the extension. The menu is not being "injected" in to the menu on the fly or anything like that. If you uninstall the extension you'd want to make sure deleting that row from #__menus is part of the delete process (which is also done via the install script). Otherwise the menu item would remain even if the extension is gone.

So the install script will get you your menu item. The next decision is how you want the request (the db query + export) to be handled when the link in the menu is clicked. The answer to that will determine if you want to use a plugin or a component.

If you try to do it as a plugin extension you'd probably need to make it part of the System plugin group and have it sniff for whatever link you used before Joomla does it's internal routing. aka, you'd want to sniff for GET request variables inside a onAfterInitialise() method.


if you decide to make the menu link's URL be:


You'd have your System plugin sniff for those request variables (ie, sniff for when option=="someComponentName" and view=="doExport") and, when found, do your query/export action. If you set your headers correctly you'd end up with a file download request of the csv file after clicking the link.


  • Pro: A tiny bit easier than making a component.
  • Con: You shouldn't have the link do anything else beside execute a file download request or redirect to some existing page. Ie, if you wanted to load a page with more options before executing the request, it wouldn't be appropriate to do via a plugin (it's possible to do, just not what plugins are made for).
  • Con: This plugin will be called for every page load front end and back end. It's small overhead but it's is still overhead on every page load. This is a good reason not to use a plugin.

The other option (and the one I'd recommend) is to use a component extension instead. You'd only need the 'admin' side (your 'site' side of the component can just be a blank index.html file).


  • Pro: Way more freedom to develop how you want. You can make a page with additional options before executing the export or you have it just export like with the plugin option.
  • Con: If all your wanting to do is export the csv when the menu link is clicked then this method might be very slightly more involved.

I'd go the component route if I were you. It's more in line with the heart of what you're trying to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.