Dede中通过SQL调用简略标题shorttitle和链接地址的方法
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>为了用这个效果,搞了2个小时,晕死了。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
目的:实现首页所需要的多篇头条文章,并行出现,节省页面空间(原文标题太长)</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
</p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode7" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
{dede:sql sql="select id,shorttitle from dede_archives where shorttitle!='' order by id desc limit 0,10"} <br>
<a href=" $id=@me;@me='';$url=GetOneArchive($id);@me=$url['arcurl'];"></a> <br>
{/dede:sql} </div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
说明:关于静态地址的获取,借用了他人的方法。<br><br>
今天我为了在dedecms 5.1 中实现专题列表页面调用shorttitle发现了这个方法:<br><br>
通过修改inc_arcspec_view.php中的<br><br><img style="max-width:100%!important;height:auto!important;"title="Dede中通过SQL调用简略标题shorttitle和链接地址的方法" alt="Dede中通过SQL调用简略标题shorttitle和链接地址的方法" src="https://zhuji.jb51.net/uploads/img/202305/262c3009dbaa6c51f850398e019f87aa.jpg"><br><br>
添加 arcs.shorttitle ,然后在模板list_spec.htm页面中通过调用就可以了,以此类推其它没有的我们也可以加入。大功完成。</p>
頁:
[1]