填多个文章id用英文逗号隔开,例如:3,5,6,8,9
2、在内容页模板里写dede:sql标签
{dede:sql sql="SELECT * FROM dede_archives WHERE arcrank>-1 AND id in(~自定义字段名~) ORDER BY FIELD(id,~自定义字段名~)"}
<a href=https://www.91084.com/"[field:id runphp=yes]$id=@me;$url=GetOneArchive($id);@me=$url['arcurl'];[/field:id]"><img src=https://www.91084.com/"[field:litpic/]">[field:title/]</a>
<p>[field:description/]</p>
{/dede:sql}
~自定义字段名~ 有2处,改成你自己的字段名,例如 ~likeids~
3、打开 /include/taglib/sql.lib.php 找到
preg_match_all("/~([A-Za-z0-9]+)~/s", $sql, $conditions);
改成
preg_match_all("/~([A-Za-z0-9_]+)~/s", $sql, $conditions);
继续找到
$sql = str_replace($conditions[0][$key], "'".addslashes($refObj->Fields[$value])."'", $sql);
改成
if(is_numeric(str_replace(',','',$refObj->Fields[$value])))
{
$sql = str_replace($conditions[0][$key], addslashes($refObj->Fields[$value]), $sql);
}
else
{
$sql = str_replace($conditions[0][$key], "'".addslashes($refObj->Fields[$value])."'", $sql);