Current location - Recipe Complete Network - Complete cookbook - What do you think of the linkage menu in the construction of phpcms website? Menu cal method of linkage menu
What do you think of the linkage menu in the construction of phpcms website? Menu cal method of linkage menu
In phpcms, the management position of linkage menu is located in "Background-Extension-Linkage Menu", which supports user-defined addition. Because the question does not specify where to call, then I will talk about the call of linkage menu from several angles used in development:

First of all, we often use in the field of user-defined data models:

The created link menu item will be applied to the background content (article) adding interface. In "Background-Content-Data Model-Field Management-Add Field", set the field type to "Linked Menu", and then select the menu you want to use through the linked menu list in the "Menu id" option, such as the regional linked menu, and set the return value method of the linked menu. Then this linked menu item can appear in the content addition editing interface.

Of course, the menu display style (drop-down, pop-up) can be configured in "Background-Extension-Linkage Menu-Modify".

Second, directly call the linkage menu in the phpcms template:

This method is not commonly used. The specific method is to enter the "background-extension-linkage menu list", and you will see that each linkage menu has a calling code. Just copy and paste this code into the template location where you want to place it.

But according to experience, this is not enough, because although the linkage menu is removed through this code, css and js files are missing when displaying this menu, resulting in the lack of style and effect, so you need to ensure that several files are introduced into your template at the same time:

statics/js/dialog.js

statics/js/linkage/js/pop.js

statics/css/dialog.css

Third, use common tags in php files or templates to directly read the data in the linked menu data table:

This method is often used in our secondary development. The data of linkage menu is stored in the data table of v9_linkage, and different levels of data can be obtained according to the field designation such as parentid.

Because the development-related methods or functions related to phpcms are complicated, I won't explain them in detail here. For details, please refer to the official development manual and video tutorial of iphpcms, and the demo code given here is easy to understand:

Demonstration of calling code in php program;

1

2

$ linkage _ db = PC _ base::load _ model(" linkage _ model "); //Introduce the model

$ data = $ linkage _ d B- & gt; select(array(' parentid ' = & gt; 0)); //Read the data of the specified condition.

Demonstration of general label writing in template;

1

2

three

four

five

{ PC:get SQL = " select * from phpcms _ linkage where parentid = 0 and keyid = 1 " num = " 99 " }

{loop $data $v}

& lt Li> province: {$ v[name]}