How to use shtml include

How to use shtml include
By applying it, some public areas of the website can be made into independent pages, and then this technology can be used to embed them into other pages that need the content of this area.

mechanism:
The SSI mechanism is a dynamic inclusion rather than a static generation. When a web server such as Apache receives a user's request and parses it to find an SSI inclusion instruction, it automatically takes out the included page and embeds it into the requested page and sends it to the user as a whole page. The user has no idea what the server has done, but only knows that he has received a complete page.

benefit:
From the working mechanism of SSI, we know that the inclusion action occurs every time a user requests a page, so if the content of the included page changes, it can be reflected in real time. Because of this, it is very easy to use it to realize dynamic embedding of static pages. We can use it to implement the public area of ​​the entire website, or publish a lot of repeated area content into an independent static page, and then include it with SSI instructions where needed, such as the header and footer of the entire site, the latest news of the entire site, the hottest rankings, etc. This technology is widely used by most portal websites, such as 163, sina, etc.

How to implement the hottest content:
First, configure the SSI environment (refer to other SSI configuration tutorials)
Then create an independent node to create an additional publishing or article page, bind a small template that calls the hottest content, specify a path and file name, and then publish it as a static html page /hot.html
Then write the following SSI instructions in the box reserved for the hottest content on the homepage of the website
<!--#include virtual="/hot.html" -->
Change the extension of the home page to index.shtml (the default document page in the directory in the server configuration should also add the shtml type)
In this way, you can see the effect by using /index.shtml. After adding a bunch of articles, you only need to update this hot.html, and you don’t need to update the homepage

This method can even make the column list block on the homepage into this format. By utilizing the additional publishing function of each node, you can publish a small page with the content list of this node at the same time as publishing the column homepage, and then embed it on the homepage with SSI instructions. In the future, you only need to update the column content and the column additional publishing page, and the homepage does not need to be refreshed at any time!

<<:  Summary of web design experience and skills

>>:  Deployment and Chinese translation of the docker visualization tool Portainer

Recommend

Zabbix's psk encryption combined with zabbix_get value

Since Zabbix version 3.0, it has supported encryp...

Tutorial on upgrading, installing and configuring supervisor on centos6.5

Supervisor Introduction Supervisor is a client/se...

Vue realizes the palace grid rotation lottery

Vue implements the palace grid rotation lottery (...

Understanding Nginx Current Limitation in One Article (Simple Implementation)

Nginx is now one of the most popular load balance...

Summary of some points to note when registering Tomcat as a service

Here are some points to note when registering Tom...

Vue ElementUI implements asynchronous loading tree

This article example shares the specific code of ...

WeChat applet realizes linkage menu

Recently, in order to realize the course design, ...

MySQL 5.7 deployment and remote access configuration under Linux

Preface: Recently I am going to team up with my p...

Sample code for implementing two-way authentication with Nginx+SSL

First create a directory cd /etc/nginx mkdir ssl ...

Detailed explanation of Object.create instance usage in js

1. Create a new object using the Object.create() ...

Linux editing start, stop and restart springboot jar package script example

Preface In the springboot configuration file, the...

Responsive layout summary (recommended)

Basic knowledge of responsive layout development ...

Solve the error "Can't locate ExtUtils/MakeMaker.pm in @INC"

When installing mha4mysql, the steps are roughly:...

Detailed steps to delete environment variables in Linux

How to delete environment variables in Linux? Use...