


dedecms custom content model on the homepage list page and how to call the tag in the content
dedecms Custom content model How to call tags on the homepage list page and content?
This article describes dedecms’ homepage, list page, and content calling methods for custom models (independent models). It is relatively simple to establish custom models (independent models) and add custom fields in the background. , two points need to be noted here:
Recommended learning: 梦Weavercms
1. If a field needs to be displayed on the front-end list page, check the box in the front-end parameters Select "Make the field available in the underlying template of the list (custom fields can only be displayed in the document template by default, but enabling this option will slow down the list query, please do not select it if necessary)";
2. The ID of the independent model must be set to a negative number, otherwise the data cannot be retrieved on the list page. This is considered a bug in dedecms. I originally planned to modify the list tag, but later I accidentally discovered that as long as the ID of the independent model is set to a negative number, it can be displayed normally.
After building the independent model and fields, the calling method on the website is as follows:
(1) Call the custom model (independent model) on the homepage:
Please call the independent model Use arclistsg independent single table model to call tags instead of arclist document list tags. Most of the tutorial articles on the Internet are for adding custom fields to existing models rather than creating new independent models, so independent models cannot be called using the arclist tag.
The code is as follows:
{dede:arclistsg typeid='8' row='10' addfields='name,sex,tel' channelid='-101' } [field:title/] 姓名:[field:name/] | 性别:[field:sex/] | 电话:[field:tel/] {/dede:arclistsg}
To obtain the content of a custom field, two conditions must be met, one of which is indispensable:
1. Specify the channelid attribute. This is channelid. ='-101'
2. Specify the fields to be obtained addfields='Field 1, Field 2'
(2) The list page calls the custom model (independent model):
The code is as follows:
{dede:list pagesize='10' addfields='name,sex,tel' channelid='-101' } [field:title/] 姓名:[field:name/] | 性别:[field:sex/] | 电话:[field:tel/] {/dede:list}
If the column has content, but the list page does not fall out, it must be because the id of your independent model is not a negative number.
(3) The content page calls the custom field data of the custom model (independent model):
Write {dede:field.name/} directly where you want to call, where name Change to the name of the field you want to call.
The above is the detailed content of dedecms custom content model on the homepage list page and how to call the tag in the content. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.