In this way, the development of site navigation and menus have such doubts ....
1. I put the contents of the menu into the database, and the targeted generation of HTML files, easy to read. But the problem arises, I do not know how to match, for example, jump to the product center, generated HTML files, can not automatically identify, this time to re-query the database, there is no other better way?
2. Query the database to find the corresponding menu options, but how can I match the corresponding menu? To judge by the address? But will this be safe?
CREATE TABLE `#DB_PREFIX#Menu` ( `list_id` INT(11) NULL AUTO_INCREMENT, `menu_id` VARCHAR(55) NOT NULL COMMENT '菜单值', `sort_id` INT(11) UNSIGNED NOT NULL COMMENT '排序ID', `parent_id` VARCHAR(55) NULL COMMENT '父类值', `name` VARCHAR(55) NOT NULL COMMENT '菜单名称', `title` VARCHAR(55) NOT NULL COMMENT '菜单标题', `en` VARCHAR(55) NOT NULL COMMENT '英文菜单名称', `icon` VARCHAR(55) NULL COMMENT '图标 / ico', `url` VARCHAR(55) NULL COMMENT '菜单超链接', `default` VARCHAR(255) NULL COMMENT '默认值 / 超链接', `type` SET('On', 'Off') NOT NULL COMMENT '审核', `published` INT(11) UNSIGNED NOT NULL COMMENT '发布时间', PRIMARY KEY (`list_id`), KEY `menu_id` (`menu_id`), KEY `sort_id` (`sort_id`), KEY `parent_id` (`parent_id`))ENGINE=#DB_ENGINE# DEFAULT CHARSET=#DB_CODE#;
Do you have any other suggestions for the design of menus and navigation? or any other better way?
Reply content:
In this way, the development of site navigation and menus have such doubts ....
1. I put the contents of the menu into the database, and the targeted generation of HTML files, easy to read. But the problem arises, I do not know how to match, for example, jump to the product center, generated HTML files, can not automatically identify, this time to re-query the database, there is no other better way?
2. Query the database to find the corresponding menu options, but how can I match the corresponding menu? To judge by the address? But will this be safe?
CREATE TABLE `#DB_PREFIX#Menu` ( `list_id` INT(11) NULL AUTO_INCREMENT, `menu_id` VARCHAR(55) NOT NULL COMMENT '菜单值', `sort_id` INT(11) UNSIGNED NOT NULL COMMENT '排序ID', `parent_id` VARCHAR(55) NULL COMMENT '父类值', `name` VARCHAR(55) NOT NULL COMMENT '菜单名称', `title` VARCHAR(55) NOT NULL COMMENT '菜单标题', `en` VARCHAR(55) NOT NULL COMMENT '英文菜单名称', `icon` VARCHAR(55) NULL COMMENT '图标 / ico', `url` VARCHAR(55) NULL COMMENT '菜单超链接', `default` VARCHAR(255) NULL COMMENT '默认值 / 超链接', `type` SET('On', 'Off') NOT NULL COMMENT '审核', `published` INT(11) UNSIGNED NOT NULL COMMENT '发布时间', PRIMARY KEY (`list_id`), KEY `menu_id` (`menu_id`), KEY `sort_id` (`sort_id`), KEY `parent_id` (`parent_id`))ENGINE=#DB_ENGINE# DEFAULT CHARSET=#DB_CODE#;
Do you have any other suggestions for the design of menus and navigation? or any other better way?
Go to the menu through the address, but you can save the address key in a hashed manner