简体   繁体   English

直接在数据库(Joomla 2.5)中为新组件添加Joomla菜单

[英]Adding Joomla menu for new component directly in DB (Joomla 2.5)

I want to add a menu for a new component in a development stage. 我想在开发阶段为新组件添加菜单。 Since it is not ready for installation, I didn't create manifest (xml) file. 由于尚未准备好安装,因此我没有创建清单(xml)文件。 I just want to add a menu item among components in the backend directly from the DB. 我只想直接从数据库在后端的组件之间添加菜单项。

I got the information here . 我在这里得到了信息。 But it is for joomla 1.5 - the table it mentions doesn't exist in joomla 2.5, so (obviously) it doesn't work. 但这是针对joomla 1.5的-它提到的表在joomla 2.5中不存在,因此(显然)它不起作用。

Any ideas to do the same thing in joomla 2.5? 有什么想法在joomla 2.5中做同样的事情吗?

After experimenting with `#__menu` table I have discovered many interesting features. 在尝试使用“ #__menu”表之后,我发现了许多有趣的功能。

There is a DB Table called #__menu in the joomla installation database. joomla安装数据库中有一个名为#__menu的数据库表。 The function of each column is stated below. 每列的功能如下所述。


id(INT) Primary key. id(INT) 主键。
title(VARCHAR) Display name of the menu. title(VARCHAR) 显示菜单名称。 Very important field. 非常重要的领域。
Menu type(VARCHAR) *Tells if the menu is 'main menu', 'top menu' , 'left-menu' …. 菜单类型(VARCHAR) *告诉菜单是否为“主菜单”,“顶部菜单”,“左菜单”...。 Admin menus are supposed to have 'main' value. 管理菜单应该具有“主”值。 But whether they are displayed on the back end or not is determined by 'client_id' field (see below), not here.* 但是它们是否显示在后端取决于“ client_id”字段(请参见下文),而不是此处。*
alias(VARCHAR) Alias of 'title'. alias(VARCHAR) 标题的别名。 But it doesn't make any effect if it is populated or not. 但是,无论是否填充,它都不会起作用。 I tried to populate it and left the 'title' field blank. 我尝试填充它,并将“标题”字段留空。 Then the menu became blank. 然后菜单变为空白。 But if I left 'alias' blank and fill 'title', the menu got text. 但是,如果我将“别名”留空并填写“标题”,则菜单中会显示文本。
note(VARCHAR) Remark (or note). note(VARCHAR) 备注(或注释)。
path(VARCHAR) Path name to be displayed in the browser address bar. path(VARCHAR) 要在浏览器地址栏中显示的路径名。 It doesn't have to relate with the 'link' information. 它不必与“链接”信息相关。 (But both 'path' and 'link' fields have to be filled in order the menu to work properly). (但是必须同时填写“路径”和“链接”字段,菜单才能正常工作)。
link(VARCHAR) URL. link(VARCHAR) URL。 Tells where the system will go when the menu is clicked. 告诉用户在单击菜单时系统将转到何处。 Important. 重要。
type (VARCHAR) Tells if the menu is component or url(external link) … . 类型(VARCHAR) 告诉菜单是组件还是URL(外部链接)…。 (Seems, it is just an 'extra' information – no visible effect on the menu). (似乎,这只是一个“额外”信息-菜单上没有可见效果)。
published (TINYINT) 发表(TINYINT)
1 – Published. 1 –已发布。 0 – Not published. 0 –未发布。 Hide/Show the menu in the front end. 隐藏/显示前端菜单。
parent_id (INT) parent_id(INT)
0- 'Main Item root' value. 0-“主项目根”值。 It should exist only once. 它应该只存在一次。
1- List among menu items on level one. 1-在一级菜单项中列出。
x- If this value is given another menu's id then it will automatically become a child (second level) menu and 'pops out 'of its parent menu. x-如果为该值提供另一个菜单的ID,则它将自动成为子菜单(第二级),并从其父菜单中“弹出”。
level (INT) Level is expected to reflect its position in the menu hierarchy. 级别(INT) 级别应反映其在菜单层次结构中的位置。 Eg. 例如。 If the menu has a parent of level one, its level must be 2. If it has a parent of level 5 it has to be level 6 menu. 如果菜单的父级为1级,则其级别必须为2级。如果菜单的父级为5级,则必须为6级菜单。 But Joomla seems to calculate its actual level by looking to its parents and ignore this value. 但是Joomla似乎是通过寻找其父母并忽略此值来计算其实际水平的。
component_id (INT) Component id. component_id(INT) 组件ID。 Value is taken from #__extensions table. 该值取自#__extensions表。 (But emptying this field doesn't seem to have any effect). (但是清空此字段似乎没有任何效果)。
ordering (INT) Ordering (standard joomla column). 订购(INT) 订购(标准joomla列)。
checked_out (INT) Check out (standard joomla column). checked_out(INT) 检出(标准的joomla列)。
checked_out_time (TIMESTAMP) Check out time (standard joomla column). checked_out_time(TIMESTAMP)签 出时间(标准的joomla列)。
browserNav (TINYINT) ? browserNav(TINYINT)
access (INT) Very important field. 访问(INT) 非常重要的字段。
1 – Public 1 –公开
2 – Registered users only. 2 –仅注册用户。
3 – Special Users (Eg. Managers and Admins ) 3 –特殊用户(例如,管理员和管理员)
img (VARCHAR) Image path if you want the menu have a background image. img(VARCHAR) 图像路径(如果希望菜单具有背景图像)。
template_style_id (INT) Template Id attached to while viewing the page associated with this menu. template_style_id(INT) 查看与此菜单关联的页面时附加的模板ID。
params (TEXT) Component configuration data. params(TEXT) 组件配置数据。
lft (INT) ? lft(INT) 吗?
rgt (INT) ? rgt(INT) 吗?
home (TINYINT) Joomla has to have one and only one default page. 主页(TINYINT) Joomla必须具有一个且只有一个默认页面。 This value determines this. 此值确定这一点。
1 – This page is default. 1 –此页面为默认页面。
0 – Not default. 0 –不是默认值。 Only one menu has to have value 1. (Most of the time 'home'). 只有一个菜单必须具有值1。(大多数时候为“ home”)。 language (CHAR) For which languages the menu displays. 语言(CHAR) 菜单显示的语言。
client_id (TINYINT) client_id(TINYINT)
0 – Open to public. 0 –向公众开放。
1 – Back end menu. 1 –后端菜单。 Even if the menu is given a back end menu item as a parent_id, if 'client_id' has value of 0, the menu will not display in admin side. 即使为菜单提供了一个后端菜单项作为parent_id,如果“ client_id”的值为0,该菜单也不会在管理端显示。 But whatever value you give in 'Menu type' field, as long as 'client_id' value is 1 it will display in the back end. 但是,无论您在“菜单类型”字段中输入的值是多少,只要“ client_id”值为1,它将显示在后端。



Scenarios: 场景:
Menu type => 'main' client_id =>'1', published=> 1/0: In this case menu is only displayed in the back end. 菜单类型=>'main'client_id =>'1',已发布=> 1/0:在这种情况下,菜单仅显示在后端。 Published value has no effect. 发布的值无效。

Menutype=> 'mainmenu', 'client_id'=>1, published=>1: The menu is displayed in both back end and front end. Menutype =>'mainmenu','client_id'=> 1,发布=> 1:菜单同时显示在后端和前端。 Published value determines its visibility. 发布值确定其可见性。 Whether the 'menutype' value is 'main' ,'mainmenu', 'top-menu' … has no effect on its visibility in back end – only 'client_id' matters. “ menutype”值是否为“ main”,“ mainmenu”,“ top-menu”……对其后端的可见性没有影响-仅“ client_id”很重要。

Menutype=> 'mainmenu', 'client_id'=>1, published=>0: Has the same effect for admin side as the scenario above. Menutype =>'mainmenu','client_id'=> 1,Published => 0:对于管理端具有与上述方案相同的效果。 But in front side, the menu is not visible (with published state 0). 但是在正面,菜单不可见(发布状态为0)。

Try This, 尝试这个,

On Joomla 1.6 onwards the component details storing table is #__extensions 从Joomla 1.6开始,组件详细信息存储表为#__extensions

Also you have set the details #__menu table too. 另外,您还设置了详细信息#__menu表。

Hope this may help you.. 希望这对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM