DEDE uses the {dede: SQL} tag to retrieve the content in the additional table of the current document.

Source: Internet
Author: User

In the near future, dedeis is used as a project. In case of a requirement, the imgurls field of a record in the additional table addonimages needs to be directly retrieved in the article_image.htm template. The content read by the secondary node changes with the gallery I selected, that is, the aid needs to be dynamically obtained.

Getting the value of the aid field makes me Tangle for a long time. Finally, I found it very simple. The template gets the id of the current document {dede: field. id /}As long as this sentence is used, the dede tag is still not skilled.

At first I wrote this:

{dede:loop table='dede_addonimages' if="aid={dede:field.aid/}"}[field:imgurls runphp='yes']echo '<pre>';echo $GLOBALS['a']=@me;echo '</pre>';[/field:imgurls]{/dede:loop}

The experiment failed because dede labels cannot be nested! (Except for the {dede: channelArtlist} tag)

Therefore, only one tag can be changed:

{dede:sql sql='SELECT imgurls FROM dede_addonimages where aid=~aid~'}[field:imgurls runphp='yes']echo '<pre>';echo $GLOBALS['a']=@me;echo '</pre>';[/field:imgurls]{/dede:sql}
The browser output is successful. It turns out that {dede: SQL} is very powerful!



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.