DEDECMS Global Label sql| SQL label

Source: Internet
Author: User
Keywords DEDECMS Global label SQL label

Sql| SQL label

Label name: SQL
Feature Description: Use a SQL query from a template to get its return
Scope: Global use
Basic syntax:
{dede:sql sql= "} underlying template {/dede:sql}
Parameter Description:
sql= Full SQL query statement
related functions:
file \include\taglib\sql.lib.php 6th
Function lib_sql (& $ctag,& $REFOBJ)
Underlying template fields:
All fields identified in the SQL statement can be invoked with [Field: Field name/] to call
Application instance:
1. Invoke a specific member post content
{dede:sql sql= ' Select * from Dede _archives where Mid=1 '}
<a href= '/plus/view.php?aid=[field:id/] ' target= ' _blank ' >[field:title/]</a>
{/dede:sql}
Mid is a user ID that can refer to the 6184.html > data table field on dede_archives in two development
2. We add the following code to the [Template]-[Global tag test] in the system background:
{dede:sql sql= select COUNT (*) as C from Dede_archives where channel=1} common articles: [FIELD:C/] Chapter {/dede:sql} <br/>
{dede:sql sql= select COUNT (*) as C from Dede_archives where channel=2} common atlas: [FIELD:C/] {/dede:sql} <br/>
{dede:sql sql= select COUNT (*) as C from Dede_archives where channel=3} common software: [Field:c/] {/dede:sql} <br/>
{dede:sql sql= select count (mid) as C from Dede_member "} Total Members: [FIELD:C/] name {/dede:sql
We test to see the effect after the run: &http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP;

We can add tags to the corresponding location of the template can be different effects, with this SQL tag to understand the MySQL friend more convenient and flexible application of the system for two times development.

Related Article

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.