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

The usage of Dream Weaving DEDECMS extension tags

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

Share

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

This article mainly introduces the use of Weaving Dream DEDECMS extension tags, the article is very detailed, has a certain reference value, interested friends must read it!

Dream weaving DEDECMS extension tag how to use?

Demonstration example of Dream Weaving DEDECMS extension tag

Recommended study: dream weaving cms

We can look at a sample tag: demotag.lib.php

If (! defined ('DEDEINC')) {exit ("Request Error!");} function lib_demotag (& $ctag,&$refObj) {global $dsql,$envs; $attlist= "row | 12 dsql,$envs; titlelen | 24"; FillAttsDefault ($ctag- > CAttribute- > Items,$attlist); extract ($ctag- > CAttribute- > Items, EXTR_SKIP); $revalue ='' / /-$revalue = 'Hello Wordword commands; / /-return $revalue;}? >

We will find that the tag works and outputs our content.

$revalue = 'Hello Wordword commands; $revalue. = "Row:". $row. "; TitleLen:". $titlelen

So we can see that this property has been created and assigned.

Next we can further modify the tag.

Function lib_writerarc ($ctag,&$refObj)

Then we can write query statements and related functions for dealing with the underlying template.

$revalue =''; $innertext = $ctag- > GetInnerText (); $ctp = new DedeTagParse (); $ctp- > SetNameSpace ('field',' [',']'); $sql = "SELECT * FROM dede_archives WHERE writer=' {$refObj- > Fields ['writer']}' limit 0, $row"; $dsql- > Execute ('me',$sql); while ($rs = $dsql- > GetArray (' me')) {$rs ['title'] = cn_substr ($rs [' title'], $titlelen); $ctp- > LoadSource ($innertext) Foreach ($ctp- > CTags as $tagid= > $ctag) {if (! emptyempty ($rs [strtolower ($ctag- > GetName ()])) {$ctp- > Assign ($tagid,$rs [$ctag- > GetName ()]);} $revalue. = $ctp- > GetResult ();}

Finally, the value return $revalue is returned

The whole document is as follows:

If (! defined ('DEDEINC')) {exit ("Request Error!");} function lib_writerarc (& $ctag,&$refObj) {global $dsql,$envs; $attlist= "row | 12 dsql,$envs; titlelen | 24"; FillAttsDefault ($ctag- > CAttribute- > Items,$attlist); extract ($ctag- > CAttribute- > Items, EXTR_SKIP); $revalue =''; $innertext = $ctag- > GetInnerText (); $ctp = new DedeTagParse (); $ctp- > SetNameSpace ('field',' [',']') $sql = "SELECT * FROM dede_archives WHERE writer=' {$refObj- > Fields ['writer']}' limit 0, $row"; $dsql- > Execute ('me',$sql); while ($rs = $dsql- > GetArray (' me')) {$rs ['title'] = cn_substr ($rs [' title'], $titlelen); $ctp- > LoadSource ($innertext); foreach ($ctp- > CTags as $tagid= > $ctag) {if (! emptyempty ($rs strtolower ($ctag- > GetName () {$GetName > ctp- ($ctp- [$GetName > ctp- ()]) }} $revalue. = $ctp- > GetResult ();} return $revalue;}? >

View debugging by dynamically browsing the page? aid=3

{dede:writerarc row='10' titlelen='6'} [field:title/] {/ dede:writerarc}

The above is all the contents of the use of Weaving Dream DEDECMS extension tags, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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