方法一:
按表随机调用:
[ecmsinfo]"select * from phome_ecms_news order by rand() desc limit 6 ",6,18,0,24,2,0[/ecmsinfo]
随机调用本栏目:
[ecmsinfo]"select * from phome_ecms_news where classid='$GLOBALS[navclassid]' order by rand() desc limit 6",6,18,0,24,2,0[/ecmsinfo]
注:
1、news为表名,两个6表示调用的数量为6条,18表示标题取18个字符,第一个0表示不显示栏名名,随机调用的操作类型固定为24,2表示模板ID,第二个0标题图片不存在也调用。
2、如果要求只调用有标题图片的内容直接把第二个0换成1
[ecmsinfo]"select * from phome_ecms_news order by rand() desc limit 6 ",6,18,0,24,2,1[/ecmsinfo]
3、多栏目内容随机调用where classid='1,2,3,6,13,14,15,17,18' order by
[ecmsinfo]"select * from phome_ecms_news where classid='1,2,3,6,13,14,15,17,18' order by rand() desc limit 6",6,18,0,24,2,0[/ecmsinfo]
方法二:
使用万能标签,把标签排序参数'newstime ASC'、'newstime DESC'、'id DESC'等换成'rand()'即可。