dedecms織夢(mèng) softlinks php循環(huán)匹配問(wèn)題 --已知 [field:softlinks/]標(biāo)簽可調(diào)出如下數(shù)據(jù):
{dede:link text='網(wǎng)址名1'} http://網(wǎng)址1 {/dede:link}{dede:link text='網(wǎng)址名2'} http://網(wǎng)址2 {/dede:link} ...{dede:link text='網(wǎng)址名n'} http://網(wǎng)址n {/dede:link}------------想要顯示的內(nèi)容:
<a href="http://網(wǎng)址1" title="網(wǎng)址名1"><img src="http://網(wǎng)址1.png" width="18" height="18" alt="網(wǎng)址名1"></a><a href="http://網(wǎng)址2" title="網(wǎng)址名2"><img src="http://網(wǎng)址2.png" width="18" height="18" alt="網(wǎng)址名2"></a>...<a href="http://網(wǎng)址n" title="網(wǎng)址名n"><img src="http://網(wǎng)址n.png" width="18" height="18" alt="網(wǎng)址名n"></a>
-----------參考代碼
代碼寫法如下:
[field:softlinks runphp='yes']preg_match_all('/=/'(.+?)/'} (.+?) {/sim', @me, $strResult, PREG_PATTERN_ORDER);$aaa=array();for($p=0;$p<count($strResult[0]);$p++){$aaa[]='<a class=tooltip href='.$strResult[2][$p].' title='.$strResult[1][$p].'><img src='.$strResult[2][$p].'.png width=18 height=18 alt='.$strResult[1][$p].'></a>';}$aaa=implode('',$aaa);@me=$aaa;[/field:softlinks]以上就是dede softlinks php循環(huán)匹配問(wèn)題的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)和解決疑問(wèn)有所幫助,也希望大家多多支持武林網(wǎng)。新聞熱點(diǎn)
疑難解答
圖片精選