show joomla component in menu item type
I made a component for Joomla and it's working ok with the direct url: http://www.something.com/index.php?option=com_pbform
The problem is that when I try to add it in the menu. When I change the menu item type, the component is listed, but when I click on it I don't get a view to apply to the menu item.
Do I have to configure anyth开发者_开发百科ing else in the component?
Thank you!
Add your component to jos_components table:
INSERT INTO jos_components (name, link, admin_menu_link, `option`)
VALUES (
'Greetings', 'option=com_greetings', 'option=com_greetings', 'com_greetings')
If you have all your views set up correctly you need to add your component into the Joomla database.
Functions and view folders must have no hyphens or underscores.
Good
- /view/viewone
- /view/viewtwo
- /view/viewthree
Bad
- /view/view_one
- /view/view_two
- /view/view_three
If you setup your component in the MVC fashion then you would have a views/layout folder structure in your component folder. Each different view you have in there will be listed in the menu types under your component name. This is where the views can be chosen.
For e.g. in your component folder structure you have
views/view_a
views/view_b
views/view_c
then in the Joomla menu selector you would have those choices to select as a view.
If you haven't setup your component as MVC then have a look at this tutorial on how to do just that http://www.joomladevuser.com/tutorials/components
I hope that helps! Cheers
You may need a metadata.xml file for each of your views. See http://docs.joomla.org/Adding_view_layout_configuration_parameters for more details
Use this simple solution. You expected to find your new component in the menu item type drop-down list, but its not there! Instead of trying to cope with that ugly MVC scrap do this:
- select "single article" from the list and SAVE your new menu item
- now open your joomla db
- select _menu table
- edit your menu row
- change link from article to index.php?option=com_yourcomponent
- save and take a look at administrator menu manager
I did migrate my Joomla 1.5
collection of Ajax/PHP scripts to Joomla 1.7.3
using this solution in just one day.
Piece of cake.
精彩评论