Sometimes for the sake of website beautification and user experience, webmasters will add some pictures on the page, so that the website looks spiritual. Here, dedecms uses custom fields to implement the method of customizing small icons on the homepage.
I. Goal: to implement the dede homepage call custom small icon document list
As follows:
Ii. Procedure
Log on to the dede background, go to "core", select "content model management" under "channel model management", and select a model change. Here we choose
"Software model", click Modify,
For example:
3. Add custom Fields
On the modify page, select field management and add a new field.
The field parameters are as follows:
The text in the form prompt is a small icon in the homepage list (you can set it to any name. This is only a prompt when you add an article in the background .)
Field name: indeximg
Field Type: the system automatically generates form fields.
Foreground parameter: No
Pagination of content: No
Data Type: image (URL only)
Default Value: NULL
Maximum length: 250 by default
Custom form html: empty
Click "OK" to add a custom field. Then, go to the software channel and add the software. An additional attribute box is displayed. This is the first
Select box for customizing small icons on the page.
4. Homepage call code
The call code is as follows:
{Dede: arclist flag = 'A' addfields = 'incluximg 'titlelen = 42 channelid = 3 row = '6'} <li class = 'indexline'> <a href = "[field: arcurl/] "class =" indextitle "> [field: array runphp = 'yes'] @ me = (empty (@ me ['inputmg '])? " ": " [field: title/] </strong> </a> </li> {/dede: arclist} Note: The red part above indicates the image to be returned if no custom small icon is specified, change it to an image of your website.
V. Code Parsing{Dede: arclist flag = 'A' addfields = 'destximg 'titlelen = 42 channelid = 3 row = '6'} In addfields = 'destximg' load the index of the indeximg segment, so that the following [field: array runphp = 'yes'] @ me = (empty (@ me ['inputmg '])? "Get the value of the indeximg field. @ Me = (empty (@ me ['inputmg '])? Determines whether the field is empty if the Custom Field indeximg is empty, return: is the value of the indeximg field. For details, see "Design by www.badubox.com!