Rendering language tag analysis engine based on content management system data model HTML (Hypertext Markup Language) template

By introducing the HTML template rendering language label analysis engine based on the content management system data model in the website content management system, the problems of insufficient flexibility, low development efficiency, security issues and poor user experience in existing technology have been solved. HTML content that is efficient, flexible, secure, and easy to expand.

CN119336328APending Publication Date: 2025-01-21GUANGDONG TENGJIE INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411539641.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

When the prior art generates HTML content dynamically in the website content management system, there is insufficient flexibility, low development efficiency, security issues and poor user experience.

Method used

Provides an HTML template rendering language tag parsing engine based on the content management system data model, including a basic tag parsing module, a sensitive word filtering module, a content link generation module, a tag permission checking module, a logical language tag parsing module and a content-related tag parsing module Etc., through the collaborative work of these modules, efficient and flexible HTML tag parsing and dynamic content generation are achieved.

Benefits of technology

It improves system flexibility and development efficiency, enhances content security and user experience, is easy to maintain and expand, and is suitable for a variety of website content management scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336328A_ABST
    Figure CN119336328A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an HTML (Hypertext Markup Language) template rendering language tag analysis engine based on a content management system data model, and belongs to the technical field of Web front-end template page development. The invention aims to solve the problems of low content generation efficiency, poor flexibility and insufficient security in the existing HTML template rendering process. Through cooperative work of a background content management data model and a plurality of core analysis modules, an efficient, flexible, safe and easy-to-expand HTML tag analysis and content dynamic generation scheme is realized. The system specifically comprises a basic label analysis module, a sensitive word filtering module, a content link generation module, a label permission checking module, a logic language label analysis module, a content related label analysis module, an interactive label analysis module and a content storage and restoration retention module. The method is suitable for various website content management scenes such as news websites, enterprise official websites and e-commerce platforms, the development efficiency and the user experience are remarkably improved, and meanwhile the safety and maintainability of the system are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] FIELD OF THE INVENTION The present invention relates to an HTML template rendering language tag parsing engine based on a content management system data model, which is suitable for the demand of dynamically generating HTML content in a website content management system (CMS). Background Art

[0002] With the rapid development of Internet technology, website content management systems (CMS) have been widely used in various websites. These systems usually need to dynamically generate HTML content to meet the needs of different users. Traditional HTML content generation methods often rely on server-side scripting languages ​​(such as PHP, Python, Java, etc.) for template rendering. Although this method is effective, it has certain limitations in flexibility and scalability.

[0003] The existing HTML content generation methods have the following shortcomings:

[0004] Lack of flexibility: Traditional template rendering methods usually require the template structure to be defined in advance, which makes it difficult to quickly adjust and expand for complex and changing content requirements.

[0005] Low development efficiency: Every modification to the content generation logic requires rewriting and debugging the backend code, increasing development and maintenance costs.

[0006] Security issues: When generating HTML content, if there is no strict input validation and content filtering mechanism, it is easy to cause security issues such as XSS (cross-site scripting attack).

[0007] Poor user experience: Dynamically generated content that loads slowly can affect the user experience, especially on mobile devices.

[0008] Therefore, a more flexible, efficient, secure and easily extensible HTML content generation method is needed to meet the needs of modern website content management. Summary of the invention

[0009] In view of this, the embodiment of the present invention aims to provide an HTML template rendering language tag parsing engine based on the content management system data model, aiming to provide an efficient and flexible solution for dynamic generation of HTML tag parsing content, thereby improving development efficiency and user experience. Its main technical solutions are as follows:

[0010] In a first aspect, an embodiment of the present invention provides an HTML template rendering language tag parsing engine based on a content management system data model, which includes:

[0011] S1-1, a basic tag parsing module, used to parse the global data model basic tags in the HTML page, identify the global data model basic tags that need to be parsed by traversing the HTML page, execute the corresponding type parsing logic and generate the parsing result, and replace the corresponding placeholder in the HTML page with the result;

[0012] S1-2, a sensitive word filtering module, is used to read the sensitive word list to be filtered from the configuration, traverse the list, and replace the matching sensitive words in the HTML content with asterisks (*) to ensure the security and compliance of the content;

[0013] S1-3, a content link generation module, is used to generate different types of URL links according to the input parameters, supports the generation of single page links, list page links and content page links, and processes configuration items such as URL separators and path rules;

[0014] S1-4, a tag permission check module, is used to check whether the current user has the permission to view the content of a tag based on the passed parameters, and supports multiple permission check methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc.

[0015] S1-5, a logic language tag parsing module, including parsing of if judgment statement tags and loop statement tags, wherein the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if true, display the HTML tag elements nested in the {tingate:if}{ / tingate:if} tag, otherwise not display. The loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and the tag contains two parameters, start and end, which are used to define the start and end numbers of the loop body, wherein start defaults to 1.

[0016] S1-6, a content-related tag parsing module, including parsing of CMS screening tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-select retrieval tags, content tags retrieval tags, paging tags and search tags. This module aims to define HTML content pages with high freedom, and realize rich page functions and effects through the combination of multiple tags.

[0017] S1-7, an interactive tag parsing module, including parsing of carousel tags, friendly link tags, message board tags, custom form tags and QR code generation tags. The carousel tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the parameters in the tag and parse it to realize the image carousel function; the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, parse and output the designated group of friendly links in sequence; the message board tag parsing function is used to identify the target address tag {tingate:msgaction} and the message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding front-end code; the custom form tag parsing function is used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and realize the user submitting the form and calling the form record function; the QR code generation tag parsing function is used to identify the {tingate:qrcode} tag and generate the corresponding QR code image.

[0018] S1-8, a module for saving and restoring retained content, which identifies the saved retained content tag {tingate:pre}{ / tingate:pre} in the page, stores the content nested in the tag in the pre array, and generates a unique temporary tag "#pre:index#" to replace the tag; and the function of restoring retained content is to identify the index in the page, then find the corresponding array through the index, output the content by traversing the array and replace the original index.

[0019] In combination with the first aspect, an embodiment of the present invention provides a basic tag parsing module, wherein in S1-1, traversing the HTML page, identifying the tags to be parsed, executing the corresponding type parsing logic and generating the parsing result, and replacing the corresponding placeholder in the HTML page with the result includes:

[0020] S1-1-1, traverse the HTML page and identify the basic tags that need to be parsed in the page;

[0021] S1-1-2, determine the tag type that needs to be parsed, execute the corresponding type parsing logic, and generate a parsing result;

[0022] S1-1-3, replace the corresponding placeholder in the HTML page with the parsing result.

[0023] In combination with the first aspect, an embodiment of the present invention provides a sensitive word filtering module, wherein in S1-2, the sensitive word list to be filtered is read from the configuration, the sensitive word list is traversed, and the matching sensitive words in the HTML content are replaced with asterisks (*), and the security and compliance of the content are ensured, including:

[0024] S1-2-1, configure the sensitive words that need to be filtered out in the content management system;

[0025] S1-2-2, read the list of sensitive words that need to be filtered and store it in the string variable $keys_arr, and use the corresponding function to process it into an array format;

[0026] S1-2-3, traverse the sensitive word array, and for each sensitive word $value, use the corresponding function to replace all its occurrences in $content with asterisks (*).

[0027] In combination with the first aspect, an embodiment of the present invention provides a content link generation module, wherein in S1-3, the content link generation module supports custom URL path rules and separators, and is used to generate different types of page links including:

[0028] S1-3-1, define URL path rules and separators in the configuration file, such as URL separator variables, URL sorting rule prefix variables, and URL rule content path variables;

[0029] S1-3-2, generate different types of links according to the passed parameters $type and $pagetype;

[0030] S1-3-3, handles the link generation logic of single page, list page (list) and content page (content);

[0031] S1-3-4, replace the corresponding tag in the HTML page with the generated URL link.

[0032] In combination with the first aspect, an embodiment of the present invention provides a tag permission checking module, wherein in S1-4, the module checks whether the current user has the permission to view a tag content according to the input parameters, and supports multiple permission checking methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc., including:

[0033] S1-4-1, traverse the HTML page and identify the permission identifier in the tag, such as showlogin in the {content:content showlogin=1} tag;

[0034] S1-4-2, obtain the permission code such as gcode, ucode, etc. contained in the session information of the current user;

[0035] S1-4-3, traverse the permission identifier in the tag in the form of key-value pairs, that is, regard "showucode" in showucode=1, 2, 3 as $key, and regard "1, 2, 3" as $value, and execute different permission judgment logic according to the type of $key through switch and case.

[0036] In combination with the first aspect, an embodiment of the present invention provides a logic language tag parsing module, wherein in S1-5, the logic language tag parsing module includes parsing of if judgment statement labels and loop statement labels including:

[0037] S1-5-1, where the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if true, display the HTML tag element nested in the {tingate:if}{ / tingate:if} tag, otherwise not display;

[0038] S1-5-2, the loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and replace the original tag in the page with the execution result.

[0039] In combination with the first aspect, an embodiment of the present invention provides a content-related tag parsing module, wherein in S1-6, the content-related tag parsing module includes parsing of CMS screening tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-selection retrieval tags, content tags retrieval tags, paging tags and search tags, including:

[0040] S1-6-1, parsing of filter tags, used to identify all filter tags {tingate:selectall} and filter value tags {tingate:select}{ / tingate:select} tags in the page, where {tingate:selectall} tag is used to display all content, field=* parameter is used to specify the filter field, and {tingate:select}{ / tingate:select} tag is used to traverse and output all options of the specified field;

[0041] S1-6-2, parsing the specified column tag, used to identify the {tingate:sort}{ / tingate:sort} tag, where the scode=* parameter is the column code, used to specify the target column;

[0042] S1-6-3, parsing the specified content list tag, used to identify the {tingate:list}{ / tingate:list} tag to retrieve the content list of the current column, and the scode=* parameter is used to specify the column whose content list needs to be retrieved;

[0043] S1-6-4, parsing of the specified content tag, used to identify the {tingate:content id=*}{ / tingate:content} tag, where id=* is a required parameter, used to control the output of the content with the specified id;

[0044] S1-6-5, parsing of content multi-image tags, used to identify the {tingate:pics id=* num=*}{ / tingate:pics} tag, and output multiple images of the specified content in sequence. The parameter id=* is the content ID number. You can also use id={content:id} or id=[list:id] to adapt to the current content and list;

[0045] S1-6-6, parse the content multiple selection call tag, which is used to identify the parsing of the {tingate:checkbox id=* field=*}{ / tingate:checkbox} tag, and output the multiple selection values ​​of the specified content in sequence. The parameter id=* controls the content that needs to be traversed, and field=* controls the field that needs to be traversed;

[0046] S1-6-7, parse the content tags to identify {tingate:tags}{ / tingate:tags}, and get data according to the id or scode parameter. If the id is specified, get the tags of a single content; if the scode is specified, get the tags of the specified column;

[0047] S1-6-8, parsing of paging tags, used to identify paging tags, such as {page:bar} is used to generate a complete paging bar, {page:current} tag is used to display the current page number, {page:pre} and {page:next} are the previous page and next page links respectively;

[0048] S1-6-9, parsing of search tags, is used to identify the {tingate:scation} tag, which is the search submission address and is nested in the action of the form. When the form submission method is get, the title field is matched by default.

[0049] In combination with the first aspect, an embodiment of the present invention provides an interactive tag parsing module, wherein in S1-7, the interactive tag parsing module includes parsing of carousel tags, friendly link tags, message board tags, custom form tags, and QR code generation tags, including:

[0050] S1-7-1, the slideshow tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the gid=* and num=* parameters in the tag to specify the slideshow grouping and quantity, and parse it to implement the image slideshow function;

[0051] S1-7-2, the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, specify the grouping through gid=*, parse and output the friendly links in sequence;

[0052] S1-7-3, message board tag parsing function, used to identify the target address tag {tingate:msgaction} and message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding front-end code, where the message board target address tag is nested in the action of the form, and the message list tag is used to display all message records;

[0053] S1-7-4, custom form tag parsing function, used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and implement the user submission form and form record retrieval functions;

[0054] S1-7-5, QR code generation tag parsing function, used to identify the {tingate:qrcode string=***} tag and generate the corresponding QR code image, where the string=** parameter can specify the content link {content:link} or the page link {tingate:pageurl}.

[0055] In combination with the first aspect, an embodiment of the present invention provides a module for saving and restoring retained content, wherein, in S1-8, the module for saving and restoring retained content stores the content nested in the tag in the pre array by identifying the saved retained content tag {tingate:pre}{ / tingate:pre} in the page, and generates a unique temporary tag "#pre:index#" to replace the tag; and the function of restoring the retained content is to identify the index in the page, find the corresponding array through the index, and output the content by traversing the array and replace the original index, including:

[0056] S1-8-1, by identifying the preservation content tag {tingate:pre}{ / tingate:pre} in the page, storing the content nested in the tag in the pre array, and generating a unique temporary tag "#pre:index#" to replace the tag;

[0057] S1-8-2, the function of restoring and retaining content is to identify the index "#pre:index#" in the page, then find the corresponding array through the index, output the content by traversing the array and replace the original index.

[0058] In a second aspect, an embodiment of the present invention provides an HTML template rendering language tag parsing engine based on a content management system data model, wherein the engine implements the efficient and flexible HTML tag parsing and content dynamic generation solution as described above.

[0059] The beneficial effects of the embodiments of the present invention are:

[0060] High flexibility: Provides a variety of tag types, such as template file tags {include file=*.html}, time format tags {content:date style=Ymd}, breadcrumb tags {tingate:position}, etc., which can be flexibly selected and combined according to different application scenarios. Supports custom URL path rules and separators to adapt to the URL specifications of different websites, improving the flexibility and adaptability of the system.

[0061] High development efficiency: The tag parsing engine can reduce code duplication and improve development efficiency. The tag parsing logic and configuration files are separated, so the content generation logic can be quickly adjusted and expanded to adapt to changing needs.

[0062] Strong security:

[0063] Sensitive word filtering: The sensitive word filtering mechanism can effectively prevent security issues such as information leakage and ensure that the generated content is safe and reliable.

[0064] Permission check: Through the tag permission check mechanism, you can control user access rights to specific content and enhance system security.

[0065] Easy to maintain and expand:

[0066] Modular design: The tag parsing engine adopts a modular design, and each functional module is independent, which is easy to maintain and expand.

[0067] Configuration-driven: Manage tag types, URL rules, and permission checks through configuration files, simplifying system management and maintenance.

[0068] Strong adaptability: It is suitable for various website content management scenarios, including news websites, e-commerce platforms, corporate websites, etc. It has a wide range of applicability. It can be integrated and used in different development platforms and frameworks, and has good compatibility and scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 :Basic tag parsing flow chart

[0070] Figure 2 :Sensitive word filtering flow chart

[0071] Figure 3 :Content link generation flow chart

[0072] Figure 4 : Tag permission check flow chart

[0073] Figure 5 : Logical language tag parsing flow chart

[0074] Figure 6 :Content-related tag parsing module structure diagram

[0075] Figure 7 :Interactive tag parsing module structure diagram

[0076] Figure 8 : Save and restore to preserve content tag parsing flow chart

[0077] Fig. 9 :Engine functional structure diagram DETAILED DESCRIPTION

[0078] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.

[0079] Please refer to Figures 1 to 9 , Fig. 9 This is a functional structure diagram of a HTML template rendering language tag parsing engine based on the content management system data model, including:

[0080] S1-1, a basic tag parsing module, used to parse the basic tags in the HTML page, identify the basic tags to be parsed by traversing the HTML page, execute the corresponding type parsing logic and generate the parsing result, and replace the corresponding placeholder in the HTML page with the result;

[0081] S1-2, a sensitive word filtering module, is used to read the sensitive word list to be filtered from the configuration, traverse the list, and replace the matching sensitive words in the HTML content with asterisks (*) to ensure the security and compliance of the content;

[0082] S1-3, a content link generation module, is used to generate different types of URL links according to the input parameters, supports the generation of about page links, list page links and content page links, and processes configuration items such as URL separators and path rules;

[0083] S1-4, a tag permission check module, is used to check whether the current user has the permission to view the content of a tag based on the passed parameters, and supports multiple permission check methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc.

[0084] S1-5, a logic language tag parsing module, including parsing of if judgment statement tags and loop statement tags, wherein the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if true, display the HTML tag elements nested in the {tingate:if}{ / tingate:if} tag, otherwise not display. The loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and the tag contains two parameters, start and end, which are used to define the start and end numbers of the loop body, wherein start defaults to 1.

[0085] S1-6, a content-related tag parsing module, including parsing of CMS screening tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-select retrieval tags, content tags retrieval tags, paging tags and search tags. This module aims to define HTML content pages with high freedom, and realize rich page functions and effects through the combination of multiple tags.

[0086] S1-7, an interactive tag parsing module, including parsing of carousel tags, friendly link tags, message board tags, custom form tags and QR code generation tags. The carousel tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the parameters in the tag and parse it to realize the image carousel function; the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, parse and output the designated group of friendly links in sequence; the message board tag parsing function is used to identify the target address tag {tingate:msgaction} and the message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding front-end code; the custom form tag parsing function is used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and realize the user submitting the form and calling the form record function; the QR code generation tag parsing function is used to identify the {tingate:qrcode} tag and generate the corresponding QR code image.

[0087] S1-8, a module for saving and restoring retained content, which identifies the saved retained content tag {tingate:pre}{ / tingate:pre} in the page, stores the content nested in the tag in the pre array, and generates a unique temporary tag "#pre:index#" to replace the tag; and the function of restoring retained content is to identify the index in the page, then find the corresponding array through the index, output the content by traversing the array and replace the original index.

[0088] Among them, in S1-1, traversing the HTML page, identifying the basic tags that need to be parsed, executing the corresponding type parsing logic and generating the parsing results, and replacing the corresponding placeholders in the HTML page with the results include:

[0089] S1-1-1, traverse the HTML page and identify the basic tags that need to be parsed in the page;

[0090] S1-1-2, determine the type of tag that needs to be parsed, such as the template file tag {include file=*.html}, where *.html is the path of the nested html file contained in the current HTML page, and the parsing logic executed by the template file tag is to add the code in the html file referenced by the tag to the location of the current HTML page template file tag; another example is the time format tag {content:date style=Ymd}, whose parsing logic is to format the date read from the database according to "year-month-day" and generate a parsing result;

[0091] S1-1-3, replace the corresponding placeholder in the HTML page with the parsing result.

[0092] Among them, in S1-2, the reading of the sensitive word list to be filtered from the configuration, traversing the list, and replacing the matching sensitive words in the HTML content with asterisks (*) includes:

[0093] S1-2-1, define the sensitive words that need to be filtered out in the configuration file, such as personal privacy information such as mobile phone number, ID number, home address, or business secrets such as internal corporate information and company financial reports;

[0094] S1-2-2, read the sensitive word list content_keyword_replace that needs to be filtered in the configuration file and store it in the string variable $keys_arr, and use the explode function to process it into an array format;

[0095] S1-2-3, traverse the sensitive word array, and for each sensitive word, use the str_replace function to replace all occurrences of it in the HTML page with asterisks (*).

[0096] Among them, in S1-3, different types of URL links are generated according to the parameters passed in, supporting the generation of about page links, list page links and content page links, processing configuration items such as URL separators and path rules, and ensuring that the generated links comply with the URL specifications of the website, including:

[0097] S1-3-1, define URL path rules and separators in the configuration file, such as defining URL address routing 'url_route' => array(), where 'url_route' is an array, which contains key-value pairs like 'home / index' => 'home / index / index', defining special characters allowed in URL 'url_allow_char' => '+', and defining the URL address suffix to end with ".html" 'url_rule_suffix' => '.html';

[0098] S1-3-2, matching the URL rules defined in the configuration file according to the incoming parameter type, URL name, page type, sort code, content ID and content file name;

[0099] S1-3-3, generate different types of URL links through the parserLink method, supporting the generation of about page links, list page links and content page links;

[0100] S1-3-4, replace the corresponding tag {php}echo $link{ / php} in the HTML page with the generated URL link.

[0101] Among them, in S1-4, the method of checking whether the current user has the authority to view the content of a certain tag according to the passed parameters supports multiple authority checking methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc., including:

[0102] S1-4-1, traverse the HTML page and identify the permission identifiers in the tags, such as {content:content showlogin=1} where showlogin=1 means that the content is visible after login. For example, the {tingate:umodify} tag points to the user information modification address. Adding showgcode=1 to this tag means that users with a specified level of 1 can access and modify user information;

[0103] S1-4-2, obtain the permission code such as gcode, ucode, etc. contained in the session information of the current user;

[0104] S1-4-3, traverse the permission identifiers in the tag in the form of key-value pairs, that is, regard "showucode" in showucode=1, 2, 3 as $key, and regard "1, 2, 3" as $value, and use switch and case to execute different permission judgment logic according to the type of $key. For example, "showgcodegt=2" means that the tag content will be displayed only when the level is greater than 2, and "hidelogin" means hiding the tag content after logging in.

[0105] Among them, S1-5, the parsing of the if judgment statement tag and the loop loop statement tag, wherein the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if it is true, the HTML tag elements nested in the {tingate:if}{ / tingate:if} tag are displayed, otherwise they are not displayed. The loop loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and the tag contains two parameters, start and end, which are used to define the start and end numbers of the loop body, where start defaults to 1, including:

[0106] S1-5-1, where the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if it is true, the HTML tag element nested in the {tingate:if}{ / tingate:if} tag will be displayed, otherwise it will not be displayed. When there are multiple judgment conditions, the conditions can be connected by the parallel symbol "&&" or the symbol "||". The if judgment statement tag supports nested if statements, such as the second-level if tag is {tingate:2if}{ / tingate:2if}. By adding numbers in front of if to distinguish the levels, the nested levels are theoretically unlimited, and numbers can be nested in sequence in this way;

[0107] S1-5-2, the loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and replace the original tag in the page with the execution result. The tag contains two parameters, start and end, which are used to define the start and end numbers of the loop body, where start defaults to 1.

[0108] Among them, S1-6, the parsing of CMS filter tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-select retrieval tags, content tags retrieval tags, paging tags and search tags. This module aims to define HTML content pages with high freedom, and realize rich page functions and effects through the combination of multiple tags, including:

[0109] S1-6-1, parsing of filter tags, used to identify all filter tags {tingate:selectall} and filter value tags {tingate:select}{ / tingate:select} tags on the page, where the field=* parameter is used to specify the filter field, the {tingate:selectall field=*} tag is used to display all the contents of the specified field, and the {tingate:select field=*}{ / tingate:select} tag is used to traverse and output all options of the specified field. For example, if a product has a color field "color" and the field contains three colors: red, yellow and blue, then the {tingate:selectall field=color} tag will output all products with the color field, and the {tingate:select field=blue}{ / tingate:select} tag will output all blue products;

[0110] S1-6-2, parsing the specified column tag, used to identify the {tingate:sort}{ / tingate:sort} tag, where the scode=* parameter is the column code, used to specify the target column, and display the content of the current column by traversing and parsing the [sort:link], [sort:name] and other tags nested in the {tingate:sort}{ / tingate:sort} tag;

[0111] S1-6-3, parsing the specified content list tag, used to identify the {tingate:list}{ / tingate:list} tag to retrieve the content list of the current column, the scode=* parameter is used to specify the column for which the content list needs to be retrieved, and display the content list of the current column by traversing and parsing the [list:link], [list:title] and other tags nested in the {tingate:list}{ / tingate:list} tag;

[0112] S1-6-4, parsing of the specified content tag, used to identify the {tingate:content id=*}{ / tingate:content} tag, where id=* is a required parameter, used to control the output of the content with the specified id, and to display the author, release date and other information of the content with the specified id by traversing and parsing the [content:author], [content:date] and other tags nested in the {tingate:content id=*}{ / tingate:content} tag;

[0113] S1-6-5, parsing of content multi-image tags, used to identify {tingate:pics id=* num=*}{ / tingate:pics} tags, and output multiple images of the specified content in sequence. The parameter num=* is used to control the number of output images, and id=* is the content ID number. You can also use id={content:id} or id=[list:id] to adapt to the current content and list;

[0114] S1-6-6, the analysis of the content multi-select call tag is used to identify the analysis of the {tingate:checkbox id=* field=*}{ / tingate:checkbox} tag, and output the multiple-select values ​​of the specified content in sequence. The parameter id=* controls the content that needs to be traversed for the multiple selection, and can also make id={content:id} and id=[list:id] adaptive to the current content and list, and field=* controls the field that needs to be traversed;

[0115] S1-6-7, parse the content tags to identify {tingate:tags}{ / tingate:tags}, get data according to the id or scode parameter, if the id is specified, get the tags of a single content, if the scode is specified, get the tags of the specified column, and tags can be used as parameters of the specified column list tag {tingate:list scode=*tags='x'} to output all the content with the x tag under the column;

[0116] S1-6-8, parsing of paging tags, used to identify paging tags, by identifying the type of paging tags and implementing the corresponding tag processing logic, such as {page:bar} is used to generate a complete paging bar, {page:current} tag is used to display the current page number, {page:pre} and {page:next} are the previous page and next page links respectively;

[0117] S1-6-9, parsing of search tags, used to identify the {tingate:scation} tag, which is the search submission address and is nested in the action of the form. When the form submission method is get, the title field is matched by default, and a hidden field can be added in the form to pass the field value to control the search field, such as <input type="hidden" name="field" value="title"> , that is, the input box is not displayed in the search form, but the field in value is passed to the field parameter to specify the search field.

[0118] Among them, S1-7, the parsing of the carousel label, the friendly link label, the message board label, the custom form label and the QR code generation label includes:

[0119] S1-7-1, the slideshow tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the gid=* and num=* parameters in the tag to specify the slideshow grouping and quantity, and parse to implement the image slideshow function. The [slide:pic] tag nested in the {tingate:slide}{ / tingate:slide} tag is the image address, and the [slide:link] tag is the address to jump to when clicking the image;

[0120] S1-7-2, the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, specify the grouping through gid=*, specify the number of friendly links to be output through num=*, parse and output the friendly links in sequence;

[0121] S1-7-3, message board tag parsing function, used to identify the target address tag {tingate:msgaction} and message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding front-end code, where the message board target address tag is nested in the action of the form, and the message list tag is used to display all message records. By parsing the parameters in the message board tag, the query conditions are constructed, the getMessage method is called to query the data, the query results are traversed, and the internal tags are replaced with actual data;

[0122] S1-7-4, custom form tag parsing function, used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and implement the user submission form and form record retrieval functions. The parameter fcode=* is used in the form record list tag to point to the retrieved form. The getForm method is used to query the form record, traverse the query results, and replace the {tingate:formlist}{ / tingate:formlist} tag with the actual data.

[0123] S1-7-5, QR code generation tag parsing function, used to identify the {tingate:qrcode string=***} tag and generate the corresponding QR code image, where the string=** parameter can specify the content link {content:link} or the page link {tingate:pageurl}, and use urlencode to encode the string parameter and store it in The src of the tag is used to generate a QR code image, and the result replaces the {tingate:qrcode string=***} tag.

[0124] Among them, S1-8, the content nested in the tag {tingate:pre}{ / tingate:pre} is stored in the pre array by identifying the saved reserved content tag in the page, and a unique temporary tag "#pre:index#" is generated to replace the tag; and the function of restoring the reserved content is to identify the index in the page, and then find the corresponding array through the index, and output the content by traversing the array and replacing the original index, including:

[0125] S1-8-1, identifying the save content tag {tingate:pre}{ / tingate:pre} in the page by calling the saveLabel function, storing the content nested in the tag in the pre array, and generating a unique temporary tag "#pre:index#" to replace the tag to ensure that the content will not be modified during the processing;

[0126] S1-8-2, the function of restoring and retaining content is to call the restorePreLabel function to identify the index "#pre:index#" in the page, and then find the corresponding array through the index, output the content by traversing the array and replace the original index.

[0127] The embodiment of the present invention aims to protect an HTML template rendering language tag parsing engine based on a content management system data model, and has the following effects:

[0128] 1. High flexibility: Supports a variety of basic tag types, such as site tags, company tags, member tags, category lists, etc., and flexibly defines tag types and parsing logic through configuration files to meet the needs of different application scenarios. Supports a variety of content-related tag parsing combinations, such as CMS filtering tags, designated column tags, designated content tags, paging tags and search tags. Through the combination of multiple tags, rich page functions and effects can be achieved.

[0129] 2. High development efficiency: Reduce front-end HTML code writing, and quickly realize dynamic content generation through configuration files and parsing modules. Modular design makes each functional module independent, easy to develop and debug, and quickly adjust and expand content generation logic.

[0130] 3. Strong security: Read the list of sensitive words that need to be filtered from the configuration, traverse the list and replace the matching sensitive words in the HTML content with asterisks (*) to ensure the security and compliance of the content. Check whether the current user has the permission to view the content of a certain tag based on the passed parameters, and support multiple permission checking methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc., to enhance the security of the system.

[0131] 4. Good user experience: Generate different types of URL links according to the incoming data model, support the generation of about page links, list page links and content page links, handle URL delimiters and path rules and other configuration items, and improve user navigation and usage experience. Support carousel tags, friendly link tags, message board tags, custom form tags and QR code generation tags, and realize rich interactive functions through these tags to improve user experience.

[0132] 5. Easy to maintain and expand: Modular design and configuration-driven approach simplify system management and maintenance. It includes parsing of if statement labels and loop statement labels, supports complex logic control, and is easy to expand and maintain.

[0133] 6. Strong adaptability: Good compatibility enables the present invention to run in different technology stacks and environments, supporting a variety of content display and management requirements. It is suitable for a variety of website content management scenarios, such as multimedia websites, corporate portals, e-commerce platforms, etc.

[0134] In summary, the present invention provides an HTML template rendering language tag parsing engine based on a content management system data model, which realizes an efficient, flexible, safe and easily extensible HTML tag parsing and content dynamic generation scheme through the collaborative work of a configuration file and a plurality of core modules. The present invention can not only parse a variety of tags and generate dynamic content, but also has the functions of logical language parsing, sensitive word filtering, and permission checking to ensure the security and compliance of the content. In addition, the modular design and configuration-driven approach make the system easy to maintain and expand, and according to the development scenario extension module, it is applicable to a variety of website content management scenarios. The present invention has a wide range of application prospects and significant technical advantages, can significantly improve development efficiency and user experience, and enhance the security and maintainability of the system.

Claims

1. A HTML template rendering language tag parsing engine based on a content management system data model, characterized in that: include: S1-1, a basic tag parsing module, used to parse the basic tags in the HTML page, identify the basic tags to be parsed by traversing the HTML page, execute the corresponding type parsing logic and generate the parsing result, and replace the corresponding placeholder in the HTML page with the result; S1-2, a sensitive word filtering module, is used to read the sensitive word list to be filtered from the configuration, traverse the list, and replace the matching sensitive words in the HTML content with asterisks (*) to ensure the security and compliance of the content; S1-3, a content link generation module, is used to generate different types of URL links according to the input parameters, supports the generation of about page links, list page links and content page links, and processes configuration items such as URL separators and path rules; S1-4, a tag permission check module, is used to check whether the current user has the permission to view the content of a tag based on the passed parameters, and supports multiple permission check methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc. 2.S1-5, a logic language tag parsing module, including parsing of if judgment statement tags and loop statement tags, wherein the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if true, display the HTML tag elements nested in the {tingate:if}{ / tingate:if} tag, otherwise not display. The loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and the tag contains two parameters, start and end, which are used to define the start and end numbers of the loop body, where start defaults to 1. 3.S1-6, a content-related tag parsing module, including parsing of CMS screening tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-select retrieval tags, content tags retrieval tags, paging tags and search tags. This module aims to define HTML content pages with high freedom, and realize rich page functions and effects through the combination of multiple tags. 4.S1-7, an interactive tag parsing module, including parsing of carousel tags, friendly link tags, message board tags, custom form tags and QR code generation tags. The carousel tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the parameters in the tag and parse it to realize the image carousel function; the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, parse and output the friendly links of the specified group in sequence; the message board tag parsing function is used to identify the target address tag {tingate:msgaction} and the message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding HTML code; the custom form tag parsing function is used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and realize the user submitting the form and calling the form record function; the QR code generation tag parsing function is used to identify the {tingate:qrcode} tag and generate the corresponding QR code image HTML code placeholder. 5.S1-8, a module for saving and restoring retained content, which identifies the saved retained content tag {tingate:pre}{ / tingate:pre} in the page, stores the content nested in the tag in the pre array, and generates a unique temporary tag "#pre:index#" to replace the tag; and the function of restoring retained content is to identify the index in the page, then find the corresponding array through the index, output the content by traversing the array and replace the original index.

6. The tag parsing engine according to claim 1, characterized in that: In S1-1, the custom data model global basic tag parsing module is used to parse the data model global basic tags in the HTML page, identify the data model global basic tags that need to be parsed by traversing the HTML page, execute the corresponding type of parsing logic language tags and generate parsing results, and replace the corresponding placeholders in the HTML page with the results, including: S1-1-1, traverse the HTML page and identify the global basic tags of the data model that need to be parsed in the page; S1-1-2, determining the logic type label to be parsed, executing the corresponding type parsing logic, and generating a parsing result; S1-1-3, replace the corresponding placeholder in the HTML page with the parsing result.

7. The tag parsing engine according to claim 1, characterized in that: In S1-2, the sensitive word filtering module reads the list of sensitive words to be filtered from the custom data model configuration, traverses the list of sensitive words, and replaces the matching sensitive words in the HTML content with asterisks (*) to ensure the security and compliance of the content, including: S1-2-1, configure the sensitive words that need to be filtered out in the content management system; S1-2-2, read the list of sensitive words to be filtered and store it in the string variable $keys_arr, and use the corresponding function to process it into an array format; S1-2-3, traverse the sensitive word array, and for each sensitive word $value, use the corresponding function to replace all its occurrences in $content with asterisks (*).

8. The tag parsing engine according to claim 1, characterized in that: In S1-3, the content link generation module supports custom URL path rules and separators, and is used to generate different types of page links including: S1-3-1, define URL path rules and separators in the configuration file, such as URL separator variables, URL sorting rule prefix variables, and URL rule content path variables; S1-3-2, generate different types of pages according to the page type parameters $type and $pagetype passed in; S1-3-3, handles the link generation logic of single page, list page (list) and content page (content); S1-3-4, replace the corresponding tag in the HTML page with the generated URL link.

9. The tag parsing engine according to claim 1, characterized in that: In S1-4, the tag permission checking module checks whether the current user has the permission to view the content of a tag according to the parameters passed in, and supports multiple permission checking methods, including display / hide by specified level, display / hide by specified user, display / hide by login status, etc. S1-4-1, traverse the HTML page and identify the permission identifier in the tag, such as showlogin in the {content:content showlogin=1} tag; S1-4-2, obtain the permission code such as gcode, ucode, etc. contained in the session information of the current user; S1-4-3, traverse the permission identifier in the tag in the form of key-value pairs, that is, regard "showucode" in showucode=1, 2, 3 as $key, and regard "1, 2, 3" as $value, and execute different permission judgment logic according to the type of $key through switch and case.

10. The tag parsing engine according to claim 1, characterized in that: In S1-5, the logic language tag parsing module includes parsing the if judgment statement tag and the loop statement tag, including: S1-5-1, where the if judgment statement tag parsing function is used to identify the {tingate:if}{ / tingate:if} tag in the template, parse and execute the judgment logic in the if statement, and if true, display the HTML tag element nested in the {tingate:if}{ / tingate:if} tag, otherwise not display; S1-5-2, the loop statement tag parsing function is used to identify the {tingate:loop}{ / tingate:loop} tag in the template, parse and execute the loop logic in the loop statement, and replace the original tag in the page with the execution result.

11. The tag parsing engine according to claim 1, characterized in that: In S1-6, the content model related tag parsing module includes parsing of CMS screening tags, designated column tags, designated content list tags, designated content tags, content multi-image tags, content multi-selection retrieval tags, content tags retrieval tags, paging tags and search tags, including: S1-6-1, parsing of filter tags, used to identify all filter tags {tingate:selectall} and filter value tags {tingate:select}{ / tingate:select} tags in the page, where {tingate:selectall} tag is used to display all content, field=* parameter is used to specify the filter field, and {tingate:select}{ / tingate:select} tag is used to traverse and output all options of the specified field; S1-6-2, parsing the specified content column tag, used to identify the {tingate:sort}{ / tingate:sort} tag, where the scode=* parameter is the column code, used to specify the target column; S1-6-3, parsing the specified content list tag, used to identify the {tingate:list}{ / tingate:list} tag to retrieve the content list of the current column, and the scode=* parameter is used to specify the column whose content list needs to be retrieved; S1-6-4, parsing of the specified content tag, used to identify the {tingate:content id=*}{ / tingate:content} tag, where id=* is a required parameter, used to control the output of the content with the specified id; S1-6-5, parsing of content multi-image tags, used to identify the {tingate:images id=* num=*}{ / tingate:images} tag, and output multiple images of the specified content in sequence. The parameter id=* is the content ID number. You can also use id={content:id} or id=[list:id] to adapt to the current content and list; S1-6-6, parse the content multiple selection call tag, which is used to identify the parsing of the {tingate:checkbox id=* field=*}{ / tingate:checkbox} tag, and output the multiple selection values ​​of the specified content in sequence. The parameter id=* controls the content that needs to be traversed, and field=* controls the field that needs to be traversed; S1-6-7, parse the content tags to identify {tingate:tags}{ / tingate:tags}, and get data according to the id or scode parameter. If the id is specified, get the tags of a single content; if the scode is specified, get the tags of the specified column; S1-6-8, parsing of paging tags, used to identify paging tags, such as {page:bar} is used to generate a complete paging bar, {page:current} tag is used to display the current page number, {page:pre} and {page:next} are the previous page and next page links respectively; S1-6-9, parsing of search tags, is used to identify the {tingate:scation} tag, which is the search submission address and is nested in the action of the form. When the form submission method is get, the title field is matched by default.

12. The tag parsing engine according to claim 1, characterized in that: In S1-7, the interactive tag parsing module includes parsing the carousel tag, friendly link tag, message board tag, custom form tag and QR code generation tag, including: S1-7-1, the slideshow tag parsing function is used to identify the {tingate:slide}{ / tingate:slide} tag, receive the gid=* and num=* parameters in the tag to specify the slideshow grouping and quantity, and parse it to implement the image slideshow function; S1-7-2, the friendly link tag parsing function is used to identify the {tingate:link}{ / tingate:link} tag, specify the grouping through gid=*, parse and output the friendly links in sequence; S1-7-3, message board tag parsing function, used to identify the target address tag {tingate:msgaction} and message list tag {tingate:message}{ / tingate:message} to be submitted by the message form, and generate the corresponding front-end code, where the message board target address tag is nested in the action of the form, and the message list tag is used to display all message records; S1-7-4, custom form tag parsing function, used to identify the form submission address tag {tingate:form} and the form record list tag {tingate:formlist}{ / tingate:formlist} and implement the user submission form and form record retrieval functions; S1-7-5, QR code generation tag parsing function, used to identify the {tingate:qrcode string=***} tag and generate the corresponding QR code image, where the string=** parameter can specify the content link {content:link} or the page link {tingate:pageurl}.

13. The tag parsing engine according to claim 1, characterized in that: In S1-8, the module for saving and restoring reserved content identifies the saved reserved content tag {tingate:pre}{ / tingate:pre} in the page, stores the content nested in the tag in the pre array, and generates a unique temporary tag "#pre:index#" to replace the tag; and the function of restoring the reserved content identifies the index in the page, finds the corresponding array through the index, and outputs the content by traversing the array and replaces the original index, including: S1-8-1, by identifying the preservation content tag {tingate:pre}{ / tingate:pre} in the page, the content nested in the tag is stored in the pre array, and a unique temporary tag "#pre:index#" is generated to replace the tag; S1-8-2, the function of restoring and retaining content is to identify the index "#pre:index#" in the page, then find the corresponding array through the index, output the content by traversing the array and replace the original index.