Thursday, April 18, 2019

Content Management System (CMS) and the application of regular expressions

Text, pictures, and other items placed in a web page in the body tag of an HTML document are referred to as content that provides readable information related to the needs of the site visitor. They usually need to be modified and modified from time to time, depending on the type and level of activity being performed in the site owner's organization. The task of implementing these changes on content is called content management, which can affect some or all of the web pages in instances where the existing content is removed, added, and edited. As a good and inevitable inevitable practice of constantly updating a website, you need to create a structure for the content management of your website. This structure is called a Content Management System [CMS]. Content management systems can take two forms - the structure of using HTML templates and the structure of a database model using a database.

The content management system, the relationship on the HTML template is constructed to perform page changes offline and then uploaded to the corresponding folder of the site. Content and HTML code are scattered. For content management systems that use a database-driven site model, the content is separate from the HMTL file. When the site is driven by a database, the content printed on the browser comes from the database, not the static HTML code that was placed in the page before uploading. Therefore, when dealing with new content in a database-driven site model, there are two related issues to consider - content submission and content printing.

1. Content Submission - You submit new content via the form. Since the HTML document is separate from the content in the database-driven site, you may have to provide the content format before committing, especially if it is long text. Some content management systems use forms with ready-made tools to directly format text, such as bold, underline, italic, and so on. If you use a normal label, you can create a custom label and place it in the appropriate place in the text in the form of a lack of formatting facilities. These tags allow you to create paragraphs, bold, underline, and more. This is the use of regular expressions to interpret these custom tags for formatting on the browser.

Regular expressions [Regexes] are essentially declarative languages ​​for [string] pattern matching. Using regular expressions, we can:

  • Checks if the string matches the specified pattern.
  • Searches the string for a substring that matches the specified pattern.
  • Extracts a substring that matches the specified pattern from the string.

The SQL SELECT statement will find the location of the pattern in its WHERE clause that matches the string in the specified table column, such as SELECT * FROM news WHERE content is similar to '%passion%'. Its function is limited to matching the pattern to the entire string. Regular expressions go a step further than using substring matching patterns in strings, which is why it is a very interesting and powerful tool for searching long text.

There are various types of regular expressions, each with its own feature set. For example, PHP supports POSIX regular expressions and Perl compatible regular expressions. POSIX is an acronym for Portable Operating System Interface. Examples of POSIX regular expression functions are ereg[], eregi[], ereg_replace[], and eregi_replace[]. Some PERL functions are preg_match[], preg_match_all, and preg_replace[].

2. Content Printing - Content submitted to the database table will contain custom tags, such as [PA] for paragraphs, [UND] for underscores, and appropriate locations for text. They are better created in a way that you understand. The script that will retrieve and print the formatted content on the browser will contain the appropriate regular expression. The regular expression looks for the location of the custom markup in the text each time and converts it to an HTML mark before the print [PA] is converted to an HTML paragraph mark. There are regular expression functions that detect these custom tags in the database, and when they match, they will replace them with the appropriate HTML tags, such as eregi_replace[' [PA]',paragragh tag] , eregi_replace[ ' [/ PA]',paragragh tag].

Database-driven site models can be used to manage frequently submitted news and job vacancies. When you have multiple submitted news or job vacancies, you can control which options you can print on your browser. You only need to submit a zero value for each content you publish for the status field in the database table. The value of the status field of the WHERE clause of the SQL SELECT statement in the content retrieval script is 1, for example SELECT * from news where status = 1. By doing so, only those records whose status changes from zero to 0 will be executed by the authorized personnel displayed. . If the vacancy has expired, the status will change from 1 to zero and disappear, while others are on the screen. In this way, web content is dynamically changed.

The power of regular expressions that match patterns in a pattern is exploited in the application, not just dynamically formatting HTML content using HTML markup. It is also useful for verifying areas such as email addresses and searching for all words or phrases that appear in very long texts, such as web-based Bibles or dictionaries. For example, the eregi_replace[] function can search the Bible for all events of Jesus or Jesus Christ. With appropriately developed scripts and well-designed databases, the rendering of search results can display the opposite text containing the matching words or phrases in the Bible and highlight them. The script can further create a hyperlink containing the page URL, which is the opposite of the full text. Google search results are a good example of such a presentation.

The development of a content management system [CMS] should make it unnecessary for managers to have knowledge of HTML code. The system should be well protected, especially if you have edited and deleted content from time to time. Accessibility should be done by logging in to an authorized person.

Protected by copyright




Orignal From: Content Management System (CMS) and the application of regular expressions

No comments:

Post a Comment