PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
<?php function GetOneImgUrl($img,$ftype=1){ if($img <> ''){ $dtp = new DedeTagParse(); $dtp->LoadSource($img); if(is_array($dtp->CTags)){ foreach($dtp->CTags as $ctag){ if($ctag->GetName()=='img'){ $width = $ctag->GetAtt('width'); $height = $ctag->GetAtt('height'); $imgurl = trim($ctag->GetInnerText()); $img = ''; if($imgurl != ''){ if($ftype==1){ $img .= $imgurl; } else{ $img .= '<img src="'.$imgurl.'" width="81" height="72" />'; } } } } } $dtp->Clear(); return $img; } } function litimgurls($imgid=0) { global $lit_imglist,$dsql; //获取附加表 $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c ON a.channel=c.id where a.id='$imgid'"); $addtable = trim($row['addtable']); //获取图片附加表imgurls字段内容进行处理 $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'"); //调用inc_channel_unit.php中ChannelUnit类 $ChannelUnit = new ChannelUnit(2,$imgid); //调用ChannelUnit类中GetlitImgLinks方法处理缩略图 $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']); //返回结果 return $lit_imglist; } function GetTags($aid) { global $dsql; $tags = ''; $query = "Select tag From `#@__taglist` where aid='$aid' "; $dsql->Execute('tag',$query); while($row = $dsql->GetArray('tag')) { $tags.= ($tags=='' ? "<a href=/tags.php?/{$row['tag']} target=_blank>{$row['tag']}</a>" : ','."<a href=/tags.php?/{$row['tag']} target=_blank>{$row['tag']}</a>"); } return $tags; } function Diy($path) { require_once(DEDEINC."/arc.partview.class.php"); global $cfg_basedir,$cfg_templets_dir,$cfg_templets_skin; $tmpfile = $cfg_basedir.$cfg_templets_skin."/".$path;//模版文件的路径 $dtp = new PartView(); $dtp->SetTemplet($tmpfile); $dtp->Display(); } function getTypeTop($tid) { /** 模板调用方法 {dede:php} $thisid = $refObj->Fields['id']; $row = $dsql->GetOne('select id,typename from #@__arctype where id='.$thisid); getTypeTop($row['id']); {/dede:php} */ if($tid==2) { return Diy('top_index_nk.htm'); } elseif($tid==3) { return Diy('top_index_fk.htm'); } elseif($tid==5) { return Diy('top_index_js.htm'); } elseif($tid==7) { return Diy('top_index_gb.htm'); } elseif($tid==6) { return Diy('top_index_gc.htm'); } elseif($tid==4) { return Diy('top_index_ck.htm'); } } function getImg($aid) { if($aid==2) { return '<img src="/standcard/images/tese_63.jpg" width="271" height="37">'; } elseif($aid==3) { return '<img src="/standcard/images/tese_64.jpg" width="271" height="37">'; } else { return '<img src="/standcard/images/tese_65.jpg" width="271" height="37">'; } }
转载请注明:谷谷点程序 » dede跟据不同的栏目调用不同的模板[原创]