*/
if (!function_exists('obtaintheme')) {
require_once DEDEINC."/archive/partview.class.php";
function obtaintheme($path)
{
global $cfg_basedir, $cfg_templets_dir, $cfg_df_style;
$tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$cfg_df_style.'/'.$path;
$dtp = new PartView();
$dtp->SetTemplet($tmpfile);
$dtp->Display();
}
}
//标签调用[field:id function='obtaintags(@me,3)'/]3表示调用文档3个标签
if (!function_exists('obtaintags')) {
function obtaintags($aid, $num = 3)
{
global $dsql, $cfg_cmspath;
$tags = '';
$query = "SELECT * FROM `#@__taglist` WHERE aid='$aid' LIMIT $num";
$dsql->Execute('tag', $query);
while($row = $dsql->GetArray('tag')) {
$link = $cfg_cmspath."/apps/tags.php?/{$row['tid']}";
$tags .= ($tags == '' ? "{$row['tag']}" : "、{$row['tag']}");
}
return $tags;
}
}
//提取文档多图片[field:body function='obtainimgs(@me,3)'/]3表示调用文档3张图片,则附加字段需添加body字段调用channelid='模型id' addfields='字段1,字段2'
if (!function_exists('obtainimgs')) {
function obtainimgs($string, $num)
{
preg_match_all("/]*)\s*src=('|\")([^'\"]+)('|\")/", $string, $matches);
$imgsrc_arr = array_unique($matches[3]);
$i = 0;
$result = '';
foreach($imgsrc_arr as $imgsrc)
{
if ($i == $num) break;
$result .= "
";
$i++;
}
return $result;
}
}
//文档图片注释自动为标题{dede:field.body function='obtainalt(@me)'/}
function obtainalt($newalt)
{
global $dsql, $id, $aid;
$myid = isset($id) ? $id : $aid;
$row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$myid'");
//图片注释自动为标题
$newalt = str_ireplace(array('alt=""', 'alt=\'\'', 'title=""', 'title=\'\''), "", $newalt);
$newalt = str_ireplace("
GetOne("SELECT * FROM `#@__archives` WHERE id='$arcid'");
$tid = $toptid==0 ? $tidsq["typeid"] : $tidsq["topid"];
}
$nofilter = (isset($_REQUEST['TotalResult']) ? "&TotalResult=".$_REQUEST['TotalResult'] : '').(isset($_REQUEST['PageNo']) ? "&PageNo=".$_REQUEST['PageNo'] : '');
$filterarr = string_filter(stripos($_SERVER['REQUEST_URI'], "list.php?tid=") ? str_replace($nofilter, '', $_SERVER['REQUEST_URI']) : $GLOBALS['cfg_cmsurl']."/apps/list.php?tid=".$tid);
$cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'");
$fieldset=$cInfos['fieldset'];
$dtp = new DedeTagParse();
$dtp->SetNameSpace('field', '<', '>');
$dtp->LoadSource($fieldset);
$biz_addonfields = '';
if (is_array($dtp->CTags)) {
foreach($dtp->CTags as $tida=>$ctag)
{
$fieldsname = $fieldsnamef ? explode(",", $fieldsnamef) : explode(",", $ctag->GetName());
if (($loadtype!='autofield' || ($loadtype=='autofield' && $ctag->GetAtt('autofield')==1)) && in_array($ctag->GetName(), $fieldsname)) {
$href1 = explode($ctag->GetName().'=', $filterarr);
$href2 = explode('&', $href1[1]);
$fields_value = $href2[0];
switch ($type) {
case 1:
$biz_addonfields .= '
';
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-outline-success btn-sm">全部' : 'GetName()."=".$fields_value,"",$filterarr).'" class="btn btn-success btn-sm">全部');
$addonfields_items = explode(",",$ctag->GetAtt('default'));
for ($i=0; $i
';
$biz_addonfields .= (preg_match("/&".$ctag->GetName()."=/is",$filterarr,$regm) ? 'GetName()."=".$fields_value,"",$filterarr).'">GetName()."=".$fields_value,"",$filterarr).'" onclick="window.location=this.value">全部' : '全部');
$addonfields_items = explode(",",$ctag->GetAtt('default'));
for ($i=0; $i