From 88425d337cadcbff87d46407d44879e680e86156 Mon Sep 17 00:00:00 2001 From: tianya Date: Mon, 14 Sep 2020 10:16:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E6=A1=A3=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E8=B0=83=E7=94=A8=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/include/taglib/arccontent.lib.php | 69 +++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/include/taglib/arccontent.lib.php diff --git a/src/include/taglib/arccontent.lib.php b/src/include/taglib/arccontent.lib.php new file mode 100644 index 00000000..30ec7a36 --- /dev/null +++ b/src/include/taglib/arccontent.lib.php @@ -0,0 +1,69 @@ +GetAtt('aid'); + $type = $ctag->GetAtt('type'); + $revalue = ""; + + if (in_array($type, array("pre", "next")) && get_class($refObj) === "Archives") { + // 在内容页面获取上一篇下一篇内容 + $asql = "WHERE id<{$refObj->Fields['id']}"; + if ($type === "next") { + $asql = "WHERE id>{$refObj->Fields['id']}"; + } + $row = $dsql->GetOne("SELECT id,channel FROM `#@__arctiny` $asql AND arcrank>-1 AND typeid='{$refObj->Fields['typeid']}' ORDER BY id DESC"); + + $channel = new ChannelUnit($row['channel'], $refObj->Fields['id']); + $fields = $dsql->GetOne("SELECT * FROM `{$channel->ChannelInfos['addtable']}` WHERE aid = {$row['id']}"); + + } + + if (!empty($aid)) { + // 指定ID获取内容 + $row = $dsql->GetOne("SELECT id,channel FROM `#@__arctiny` WHERE id={$aid} AND arcrank>-1"); + $channel = new ChannelUnit($row['channel'], $aid); + $fields = $dsql->GetOne("SELECT * FROM `{$channel->ChannelInfos['addtable']}` WHERE aid = {$row['id']}"); + } + + + $innerText = trim($ctag->GetInnerText()); + $ctp = new DedeTagParse(); + $ctp->SetNameSpace('field','[',']'); + $ctp->LoadSource($innerText); + + + if(is_array($ctp->CTags)) + { + foreach($ctp->CTags as $tagid=>$ctag) + { + if(isset($fields[$ctag->GetName()])) { + $ctp->Assign($tagid,$fields[$ctag->GetName()]); + } + } + $revalue .= $ctp->GetResult(); + } + + return $revalue; + +} \ No newline at end of file