Dynamic Siteweaver using a custom label to implement a list of random articles

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

The advantage of adding a random list of articles to a page is to reduce the similarity of the page in the site and avoid the search engine to treat the page as a copy page. My QQ code station, this station is this situation. Then to achieve the function is: output a random list of articles, each time the HTML page generated, the list is not the same, each page list is also different, of course, if not generated static, then each refresh the page, the list will change.

The dynamic Siteweaver itself does not provide the ability to generate a list of random articles, there is no relevant plug-ins, to achieve this function can only use the dynamic custom tags, the following provides two versions, Access version and SQL version of the SQL version of the forum is cited easy to write.

One, easy Siteweaver+sql database implementation of random articles list:

Create a new function tag in the background Custom label management:

Label Name: {$MY _ Random article}-customizable label name

Query statement: Select Top articleid,classid,title,updatetime from Pe_article where Channelid in ({input (0)}) and ClassID in ({INP UT (1)}) and DateDiff (Day,updatetime,getdate ()) <7 and Deleted=0 and status=3 order by NEWID ()

Label contents: {loop}{infobegin}{$Field (2,text,22,2,1)}

{Infoend} {/loop}

Call method: In the template appropriate place to add: {$MY _ random article (channel ID, column ID)} Can, channel ID, column ID according to their actual changes.

Description:

1, select Top 10 .... 10 is to query the number of articles, you can change their own, but it is not recommended to change too much.

2, if you do not want to call the column, but call a channel under the article, then you can put Channelid in ({input (0)}) and ClassID in ({input (1)}) modified to: Channelid in ({input (0)}), the corresponding, The call tag is: {$MY _ random article (channel ID)}.

3, DateDiff (Day,updatetime,getdate ()) <7 .... 7 refers to the search for the last 7 days of the article, according to your needs to modify.

Second, dynamic easy siteweaver+access database implementation of random articles list:

Create a new function tag in the background Custom label management:

Label Name: {$MY _ random article can be customized label name

Query statement: Select Top articleid,classid,title,updatetime from Pe_article where Channelid in ({input (0)}) and ClassID in ({INP UT (1)}) and DateDiff ("D", date (), updatetime) <7 and deleted={$PE _false} and Status=3 order by right (CStr (Rnd ( Articleid+rnd (-timer ()) *100)) *1000*now (), 2);

Label contents: {Loop}{infobegin}

{$Field (2,text,44,2,1)}

{Infoend} {/loop}

Call Method: Ibid.

Description: Ditto.

It's too much trouble to implement random in access, the core sentence of this tag is: ORDER by right (CStr (Rnd (Articleid+rnd (-timer ()) *100)) *1000*now (), 2) This sentence, In the SQL of a function can be implemented in access but there are so many layers, but this sentence to ensure the randomness, the specific effect can be seen in this column of the article page http://www.ttome.com/qzcode/.

To explain is: good effect is the premise of the loss of performance, this code is very inefficient, so if a large number of static pages, it is recommended that when fewer visitors. Try to produce as little as possible at once, or you can modify the config.asp file in the dynamic installation directory:

Const maxperpage_create = 10 ' One generation quantity, change him smaller.

Const sleeptime = 3 ' Generation interval, make him bigger.

Or if you don't care about the randomness of each article, you can streamline the order by right (CStr (Rnd (-int (Articleid+rnd (-timer) *100)) *1000*now (), 2) ", Expect the master to write more efficient sentences, or directly write a plug-in out, hehe.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.