|
|
@@ -22,19 +22,21 @@ if (!function_exists('obtaintheme')) { |
|
|
|
}
|
|
|
|
}
|
|
|
|
//标签调用[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')) {
|
|
|
|
function obtaintags($aid, $num = 3)
|
|
|
|
{
|
|
|
|
global $dsql, $cfg_cmspath, $cfg_rewrite;
|
|
|
|
$tags = '';
|
|
|
|
$query = "SELECT * FROM `#@__taglist` WHERE aid='$aid' LIMIT $num";
|
|
|
|
$dsql->Execute('tag', $query);
|
|
|
|
while ($row = $dsql->GetArray('tag')) {
|
|
|
|
if ($cfg_rewrite == 'Y') {
|
|
|
|
$link = $cfg_cmspath."/tags/{$row['tid']}";
|
|
|
|
} else {
|
|
|
|
$link = $cfg_cmspath."/apps/tags.php?/{$row['tid']}";
|
|
|
|
$tags .= ($tags == '' ? "<a href='{$link}'>{$row['tag']}</a>" : "、<a href='{$link}'>{$row['tag']}</a>");
|
|
|
|
}
|
|
|
|
return $tags;
|
|
|
|
$tags .= ($tags == '' ? "<a href=\"{$link}\">{$row['tag']}</a>" : "、<a href=\"{$link}\">{$row['tag']}</a>");
|
|
|
|
}
|
|
|
|
return $tags;
|
|
|
|
}
|
|
|
|
//提取文档多图片[field:body function='obtainimgs(@me,3)'/]3表示调用文档3张图片,则附加字段需添加body字段调用channelid='模型id' addfields='字段1,字段2'
|
|
|
|
if (!function_exists('obtainimgs')) {
|
|
|
@@ -44,10 +46,10 @@ if (!function_exists('obtainimgs')) { |
|
|
|
$imgsrc_arr = array_unique($matches[3]);
|
|
|
|
$i = 0;
|
|
|
|
$result = '';
|
|
|
|
foreach($imgsrc_arr as $imgsrc)
|
|
|
|
foreach ($imgsrc_arr as $imgsrc)
|
|
|
|
{
|
|
|
|
if ($i == $num) break;
|
|
|
|
$result .= "<img src=\"$imgsrc\">";
|
|
|
|
$result .= "<img src=\"{$imgsrc}\">";
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
@@ -58,7 +60,6 @@ function obtainalt($newalt) |
|
|
|
{
|
|
|
|
global $dsql, $id, $aid;
|
|
|
|
$myid = isset($id) ? $id : $aid;
|
|
|
|
$title = isset($row['title']) ? $row['title'] : '';
|
|
|
|
$row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$myid'");
|
|
|
|
//图片注释自动为标题
|
|
|
|
$newalt = str_ireplace(array('alt=""', 'alt=\'\'', 'title=""', 'title=\'\''), "", $newalt);
|
|
|
|