How does Dreamweaver improve the speed of web page access?
How to improve the speed of web page access
We know that speeding up the opening speed of web pages is to improve the user experience an effective strategy. There are many factors that affect the opening speed of web pages. Today I will talk about how to speed up the opening speed of web pages by optimizing the internal program of DreamWeaver CMS.
First of all, process the Javascript of the article page. There is a large section of Javascript in front of the default template, which may be a little more than 2KB, and each page is 2KG. I will extract this JS and save it as a file. I only need to download it once in the future. But be careful to replace the path in JS according to your own situation.
Secondly, I found that the article was stuck when it came to the number of clicks. The time difference was less than ten seconds. I felt very bad. It turned out that I was checking data, which affected the speed. In fact, we can write it here using AJAX. The specific method is:
1. Modify the template to remove the line
<script src="{dede:field name='phpurl'/}/count.php?view=yes&aid={dede:field name='id'/}&mid={dede:field name='mid'/}" type='text/javascript' language="javascript"></script>
and add
2. Add a JS function to the JS file mentioned in the first step
function getClick(aid,mid) { var taget_obj = document.getElementById('article_click'); myajax = new DedeAjax(taget_obj,false,false,'','',''); myajax.SendGet2("/plus/count.php?ajax=yes&mid=" +mid +"&aid=" +aid); //这里要根据情况改成网站的实际路径 DedeXHTTP = null; }
3. Modify the plus/count.php file. Add the following code before exit()
if(!empty($ajax)) { $row = $dsql->GetOne(" Select click From `{$maintable}` where {$idtype}='$aid' "); if(is_array($row)) { echo $row['click']; } }
3. PutChanged to:
<script language="javascript" type="text/javascript">getClick({dede:field name='id'/},mid={dede:field name='mid'/});getDigg({dede:field.id/});</script>。
In fact, as long as the getClick function is placed at the end of the article, it doesn’t matter where it is.
Recommended tutorial: dedecms tutorial
The above is the detailed content of How does Dreamweaver improve the speed of web page access?. 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.