Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that the universal tag loop can not be input into URL in Weaving Dream Dedecms

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to solve the problem that the universal tag loop in Dream Weaving Dedecms cannot be entered into URL. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

What if the universal label loop in Weaving Dream Dedecms cannot be entered into URL?

Universal label loop is free to call any table in the dedecms data label, so called universal tag but today in the use of loop found that our commonly used arcurl is empty, meaning that url does not have that is equal to the tag is not, I will come to you to solve this problem.

First, let's take a look at the official description of the loop tag.

Tag name: loop

Function description: call the data label of any table

Scope of application: global tag

The basic syntax is as follows:

The code is as follows:

{dede:loop table='dede_archives' sort='' row='4' if=''} [field:title/] {/ dede:loop}

Tag attributes:

Table: query table name

Sort: fields used for sorting

Row: the number of results returned

If: the condition of query

According to this, I wrote a simple example, the code is as follows:

The code is as follows:

{dede:loop table='dede_archives' sort='' row='4' if=''} [field:title/] {/ dede:loop} / / output result Hello dedecms

You will notice that if href='' is empty, there is no url address, so this tag is useless for me. Baidu has found a solution.

1. Open Include/common.func.php, find line 54, and add a function code here as follows:

The code is as follows:

Function IDReturnURL ($ID) {/ / lonely 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;}

two。 The way we write the call in the template has also changed. The code is as follows:

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 solved perfectly, and the same is true when you want to use custom sql tags.

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

Later, I thought about it, so I went on to find an arclist tag, the code is as follows:

The code is as follows:

{dede:arclist flag='h' typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword='' limit='0,1'} [field:title/] {/ dede:arclist}

So we can use the following code directly:

The code is as follows:

{dede:arclist row='10' titlelen='24' orderby='pubdate' idlist='' col='2'} [field:textlink/] ([field:pubdate function=MyDate ('mmurdongjie) /]) {/ dede:arclist}

It can be solved.

Thank you for reading! On Weaving Dream Dedecms universal label loop can not enter URL how to solve how to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report