seo

How to update website static Html clicks

After generating your own web page into static Html, although the speed and SEO have been greatly improved, the ensuing problems have also arisen. Some content needs to be stored in static […]

article directories

After generating your own web page to static Html, although the speed andSEOThere have been great improvements, but the problems that come with it have also arisen. Some content needs to be dynamically displayed in static Html, such as the number of clicks. For each click, the number of clicks will be increased once. Obviously, this is in purely static pages. There is no way to achieve it inside, because the number of clicks is stored in the database, and pure static Html has nothing to do with the database.

The same principle is true for PHP and ASP. If you want to display dynamic content in static Html, you can only encapsulate the dynamic content and then call it. The following is an example of PHP updating clicks I wrote. In the following file, you encapsulate the clicks update into a PHP file and finally output it in JS form, so that you can output the dynamic clicks to the static file through JS. The source code for PHP updating clicks is as follows:

< ? php include(“global.php”); $row=$art->get_row($id);

mysql_query(“update `”.PRE.”article` set `hits`=`hits`+1 where id=".intval($row['id'])) or die (showmsg(" Error occurred in updating clicks!"));

$rows=mysql_fetch_assoc(mysql_query($sql=”select * from doorsjk_article where id=”.intval($row[“id”])));

$str=$rows[“hits”];

?>

< ? php echo “document.write(‘”.$ str.”‘); n”; ?>

include("global.php"); This sentence is the connection database file included,$row=$art->get_row($id); this sentence is the accepted ID, which has been called into a class, and the accepted ID. The following is easy to understand, adding 1 to the field hits of the data table, and the final echo is to output the new hits.

When using it, you only need to include the PHP file with the number of updates

 

Static pages can also call text, etc. to update the number of clicks. The example here is that the number of clicks field is stored in the database, which is also the method used by most people. To draw inferences from one example, dynamic content such as "latest articles" and "article comments" can also be called in static Html through JS files.