search
Homephp教程php手册织梦 dedecms 中LOOP 万能标签循环 调用 arcurl标签(获取链接),dedecmsarcurl

织梦 dedecms 中LOOP 万能标签循环 调用 arcurl标签(获取链接),dedecmsarcurl

在DEDECMSV5.3中,提供了loop万能循环标签,但是此循环标签只能循环出该表中的字段,而“[field:arcurl/]”链接标签并不能被解析出来,而DEDECMS官方论坛上也没有找到相关的解决办法,所以只有自己动手写代码了!

这是官方提供的代码:
{dede:loop table='dede_archives' sort='' row='4' if=''}
[field:title/]
{/dede:loop}
以下是我的解决方案:

1.打开Include/common.func.php,找到54行,再这里添加一个函数代码如下:

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.而在模板中我们的调用方式的写法也有所改变,代码如下:

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

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

  • {/dede:loop}
    问题已经完美解决了!

    同样的当你要用自定义sql 标签的时候,也是一样的。

    其实,就是用[field:id function=IDReturnURL(@me)/]代替了[field:arcurl/]标签,我解决此问题的核心就是[field:id function=IDReturnURL(@me)/]和IDReturnURL!



    在sql标签中

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

    也可以调出来。

    dedecms里面的标签datalist,调用arcurl,让它指向内容页

    href=后面不要用引号
     

    织梦php代码中 arcurl 怎更改连接地址

    [field:arcurl/]这个代码的意思是,调文章的时候,调对应的链接,如果你改成一个链接,所以的文章都是这样的链接。
     

    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

    SecLists

    SecLists

    SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

    mPDF

    mPDF

    mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    DVWA

    DVWA

    Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software