In dedecms, the LOOP universal tag cyclically calls the arcurl tag (get Link) and dedecmsarcurl

Source: Internet
Author: User

In dedecms, the LOOP universal tag cyclically calls the arcurl tag (get Link) and dedecmsarcurl

The loop universal loop label is provided in DEDECMSV5.3, but this loop label can only loop out fields in the table, and the "[field: arcurl/]" link label cannot be parsed, the DEDECMS official forum did not find any related solutions, so I had to write the code myself!

This is the official code:
{Dede: loop table = 'dede _ archives 'sort = ''row = '4' if = ''}
<A href = '[field: arcurl/]'> [field: title/] </a>
{/Dede: loop}
Here are my solutions:

1. Open Include/common. func. php and find 54 rows. Add a Function Code as follows:

Function IDReturnURL ($ ID)
{
Global $ dsql;
$ Query = "Select arc. *, tp. typedir, tp. typename, tp. corank, tp. isdefault,
Tp. defaultname, tp. namerule, tp. moresite, tp. siteurl, tp. sitepath
From dede_archives arc left join dede_arctype tp on arc. typeid = tp. id where arc. id = ". $ ID;
$ Row = $ dsql-> GetOne ($ query );
$ ReturnURL = GetFileUrl ($ row ['id'], $ row ['typeid'], $ row ['senddate'], $ row ['title'], $ row ['ismake'],
$ Row ['arcrank '], $ row ['namerule'], $ row ['typedir'], $ row ['money'], $ row ['filename'], $ row ['moresite '], $ row ['siteurl'], $ row ['sitepath']);
Return $ ReturnURL;
}
2. The method of calling in the template has also changed. The Code is as follows:

{Dede: loop table = 'dede _ archives 'sort = ''row = '4' if = ''}
<Li> · <a href = '[field: id function = IDReturnURL (@ me)/]'> [field: title function = cn_substrR (@ me, 44) /] </a> </li>
{/Dede: loop}
The problem has been solved perfectly!

The same is true when you use custom SQL labels.

In fact, [field: id function = IDReturnURL (@ me)/] is used to replace the [field: arcurl/] tag. The core of my solution to this problem is [field: id function = IDReturnURL (@ me)/] And IDReturnURL!



In the SQL label

[Field: id runphp = 'yes'] $ arcRow = GetOneArchive (@ me); @ me = $ arcRow ['arcurl']; [/field: id]

You can also call it out.


The tag datalist in dedecms calls arcurl to point it to the content page

Href = do not use quotation marks

In the zhimeng php code,

[Field: arcurl/] This Code indicates that when you call an article, you can call the corresponding link. If you change it to a link, all the articles are such links.

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.