Home  >  Article  >  Backend Development  >  LOOP universal tag loop in Dedecms dedecms calls arcurl tag (get link), dedecmsarcurl_PHP tutorial

LOOP universal tag loop in Dedecms dedecms calls arcurl tag (get link), dedecmsarcurl_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:22:16903browse

The LOOP universal tag in dedecms calls the arcurl tag (get the link). dedecmsarcurl

In DEDECMSV5.3, the loop universal loop tag is provided, but this loop tag only The fields in the table can be looped out, but the "[field:arcurl/]" link tag cannot be parsed, and there is no relevant solution found on the official DEDECMS forum, so I have to write the code myself!

This is the official code:
{dede:loop table='dede_archives' sort='' row='4' if=''}
[field:title/]
{/dede:loop}
The following is my solution:

1. Open Include/common. func.php, find line 54, and add a function code here 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 writing of our calling method in the template has also changed. The code is as follows:

{dede:loop table='dede_archives' sort= '' row='4' if=''}

  • ·[field:title function=cn_substrR( @me,44)/]

  • {/dede:loop}
    The problem has been perfectly solved!

    The same is true when you want to use custom sql tags.

    Actually, [field:id function=IDReturnURL(@me)/] is used instead of [field:arcurl/] tag. The core of my solution to this problem is [field:id function=IDReturnURL(@me )/] and IDReturnURL!



    In sql tag

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

    can also be called out.

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

    Do not use quotation marks after href=

    How to change the arcurl connection address in the DreamWeaver PHP code?

    [field:arcurl/]The meaning of this code is that when adjusting an article, adjust the corresponding link. If you change it to a link, all articles will have such links.


    http://www.bkjia.com/PHPjc/849147.html

    www.bkjia.com

    truehttp: //www.bkjia.com/PHPjc/849147.htmlTechArticleThe LOOP universal tag in dedecms calls the arcurl tag in a loop (get the link), dedecmsarcurl is provided in DEDECMSV5.3 The loop universal loop tag is provided, but this loop tag can only loop out...
    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