search
HomeCMS TutorialDEDECMSHow does Dreamweaver improve the speed of web page access?

How does Dreamweaver improve the speed of web page access?

Nov 09, 2019 pm 01:22 PM
dream weavingAccess speed

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=&#39;phpurl&#39;/}/count.php?view=yes&aid={dede:field name=&#39;id&#39;/}&mid={dede:field name=&#39;mid&#39;/}" type=&#39;text/javascript&#39; 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(&#39;article_click&#39;); 
myajax = new DedeAjax(taget_obj,false,false,&#39;&#39;,&#39;&#39;,&#39;&#39;); 
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}=&#39;$aid&#39; "); 
if(is_array($row)) 
{ 
echo $row[&#39;click&#39;]; 
} 
}

3. PutChanged to:

<script language="javascript" type="text/javascript">getClick({dede:field name=&#39;id&#39;/},mid={dede:field name=&#39;mid&#39;/});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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.