php 为范围飞
为范围飞 [代码片段(70行)]
<?php
function litimgurls($imgid=0)
{
global $lit_imglist,$dsql;
//获取附加表
$row = $dsql->GetOne("SELECT c.addtable FROM 1sohu_archives AS a LEFT JOIN 1sohu_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 GetOneImgUrl
@@ 功能:读取自定义字段图片地址
*****************/
function GetOneImgUrl($img,$ftype=1){
echo $img;
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="'.$width.'" height="'.$height.'" />';
}
}
}
}
}
$dtp->Clear();
return $img;
}
}
/*根据文章id 返回文章arcurl
*$ID 文章id
*/
function getArcurlByArcid($ID)
{
global $dsql;
$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath from dede_archives arc left join dede_arctype tp on arc.typeid=tp.id where arc.id = ".$ID;
$row = $dsql->GetOne($query);
$ReturnURL = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
return $ReturnURL;
}
//该片段来自于http://outofmemory.cn
- 上一篇:php 验证是否是md5编码
- 下一篇:PHP打印echo,你可能不知道的用法
精彩图集
精彩文章






