电话
13363039260
调用子栏目文章记录数
1 2 3 4 5 6 7 8 9 10 | {eyou:channelartlist typeid= '总栏目id' } {eyou:channel type= "son" } {$field.typename}<! -- 这是子栏目名称 --> {eyou:assign name = "typeid" value= "$field.typeid" } <! -- 获取栏目id变量 --> {eyou:sql sql= "SELECT count(typeid) AS count FROM ey_archives WHERE typeid= $typeid" cachetime= '-1' } <span>{$field. count }</span> {/eyou:sql} {/eyou:channel} {/eyou:channelartlist} |
或更简单的
1 2 3 | {eyou:channel typeid='总栏目id'} {$field.typename}-{$field.typeid|GetTotalArc=###} {/eyou:channel} |
统计搜索结果页关键词文章数量
位置:lists_search.htm
1 2 3 4 5 6 | {eyou:assign name="keywords" value="$eyou.field.keywords"} <!--通过自定义变量assign获取关健词--> {eyou:sql sql="Select count(*) as AllNum from ey_archives where title like '%$keywords%'" cachetime='-1'} {$field.AllNum} <!--返回查询数量为allNum字段--> {/eyou:sql} |
统计网站会员数量
1 2 3 | {eyou:sql sql= 'SELECT count(users_id) AS count FROM ey_users WHERE is_activation = 1' cachetime= '-1' } {$field. count } {/eyou:sql} |
统计整站文章数量
1 2 3 | {eyou:sql sql= 'Select count(*) as AllNum from ey_archives' cachetime= '-1' } {$field.AllNum} {/eyou:sql} |
调用最新文章
相对用arclist列表中的typeid=''来指定,用SQL更方便吧。
1 2 3 4 5 | {eyou:sql sql= 'SELECT aid FROM ey_archives order by aid desc limit 5' cachetime= '-1' } {eyou:arcview aid= "$field.aid" id= "field2" } <li><a href= "{$field2.arcurl}" >{$field2.title}</a></li> {/eyou:arcview} {/eyou:sql} |
详情页调用投稿者文章
1 2 3 4 5 6 7 8 9 | {eyou:assign name='usersid' value='$eyou.field.users_id'/} <!-- 获取投稿者用户ID --> {eyou:sql sql='SELECT aid FROM ey_archives WHERE users_id = "$usersid" AND channel = "1" order by aid desc limit 5' cachetime='-1'} {eyou:arcview aid="$field.aid" id="field2"} < li class = "height" >< a href = "{$field2.arcurl}" target = "_blank" >{$field2.title}</ a ></ li > {/eyou:arcview} {/eyou:sql} <!-- 读取该用户ID的最近5篇文章,channel = "1"J是文章模型ID。 --> |