1、phpcms 怎麼 每次顯示兩條數據 循環輸出20條數據
如果數據量太大,一次性讀的話,客戶端也會非常慢
Lisp是如今正在被廣泛使用的第二古老的高級編程語言。其名稱 Lisp 派生自「列表處理語言(List Processing Language)」。Lisp 支持的重要數據結構之一是鏈表。 Lisp 程序會將源代碼當做是數據結構。
2、phpcms中 loop如何循環get標簽里邊的數據?loop如何得到數據源
loop到沒有研究過,一直用的get標簽
他是經過 include/db_mysql.class.php 里處理過,其後還有其它什麼吧,
3、dede cms怎麼增加一個變數,循環出來的每一個數字都增加呢!求大俠出現
dede:list標簽不支持標簽嵌套,你可以使用dede:php標簽試試~
4、帝國cms 列表循環代碼?
這個是列表模板裡面添加的東西
[!--empirenews.listtemp--]
<!--list.var1-->
[!--empirenews.listtemp--]
<!--list.var1-->的東西為
<li><span class="newslist-date">[[!--newstime--]]</span><a href="[!--titleurl--]">[!--title--]</a></li>
如此這樣的就是循環列表代碼
5、在cmseasy中怎麼實現循環和調用數據
本文介紹通過修改程序源碼實現在管理資訊時批量添加Tags,效果如下圖:
修改步驟:
1、以下代碼加入到admin/ecmsinfo.php,在任意2個elseif中間插入就行
elseif($enews=="AddTags_all")//列表批量添加Tags
{
$classid=$_POST['classid'];
$id=$_POST['id'];
$tags=$_POST['add_listtags'];
$newstime=time();
eInsertTags2($tags,$classid,$id,$newstime);
}
2、將以下代碼加入到class/uesrfun.php
//加入TAG表
function eInsertTags2($tags,$classid,$id,$newstime){
global $empire,$dbtbpre,$class_r;
if(!trim($tags))
{
printerror("TAGS信息不能為空", "", 1, 0, 1);
return '';
}
$count = count($id); //統計ID數量
$tags = RepPostVar($tags);
$tag = explode(",", $tags);
if (emptyempty($count))
{
printerror("未選擇信息ID", "", 1, 0, 1);
}
if (count($tag)>1)
{
printerror("只能添加一個TAGS詞", "", 1, 0, 1);
}
$classid=(int)$classid;
$id[$i] = (int)$id[$i];
$mid=(int)$class_r[$classid][modid];
for($i=0;$i<$count;$i++)
{
$tbname=$class_r[$classid][tbname];//獲取表名
$r=$empire->fetch1("select tagid from {$dbtbpre}enewstags where tagname='$tags' limit 1");
$t = $empire->fetch1("select infotags from {$dbtbpre}ecms_".$tbname." where id='$id[$i]'");
$taga=$t['infotags'].",".$tags; //組合TAGS
$tagb[$i] = explode(",",$taga); //設置數組
$tagc=array_values(array_unique($tagb[$i])); //數組排重
for($t=0;$t<count($tagc);$t++)
{//二級子循環TAGS數組輸出
$newtags[$i].= ",".$tagc[$t];
}
if($r[tagid])
{
$datar=$empire->fetch1("select tagid,classid,newstime from {$dbtbpre}enewstagsdata where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
if($datar[tagid])
{
if($datar[classid]!=$classid||$datar[newstime]!=$newstime)
{
$empire->query("update {$dbtbpre}enewstagsdata set classid='$classid',newstime='$newstime' where tagid='$r[tagid]' and id='$id[$i]' and mid='$mid' limit 1");
}
}
else
{
$empire->query("update {$dbtbpre}enewstags set num=num+1 where tagid='$r[tagid]'");
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$r[tagid]','$classid','$id[$i]','$newstime','$mid');");
}
}
else
{
$empire->query("update {$dbtbpre}ecms_".$tbname." set infotags='".trim($newtags[$i],",")."' where id='$id[$i]'");
$empire->query("insert into {$dbtbpre}enewstags(tagname,num,isgood,cid) values('$tags',1,0,0);");
$tagid=$empire->lastid();
$empire->query("insert into {$dbtbpre}enewstagsdata(tagid,classid,id,newstime,mid) values('$tagid','$classid','$id[$i]','$newstime','$mid');");
}
}
printerror("批量添加TAGS成功", "", 1, 0, 1);
}
3、信息管理列表模板最後一列修改成以下代碼,在e/data/html/list/文件夾內
<td height="25" colspan="8">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="68%" height="25">
<font color="#666666">備註:多選框藍色為未審核信息;發布者紅色為會員投稿;信息ID粗體為未生成,點擊ID可刷新頁面.</font>
</td>
<td width="32%"> <input type="text" name="add_listtags" id="add_listtags" size="50" value="" />
<input type="submit" name="Submit100" value="添加TAGS" onClick="document.listform.enews.value='AddTags_all';document.listform.action='ecmsinfo.php';">
</td>
</tr>
</table>
</td>
6、phpcms:如何實現間隔N條後調取一條,並且循環調取
你的問題里提到了兩個詞,一個是「顯示」,一個是「調取」,這在phpcms模板製作里是分開執行的兩個動作。所以我們分開來說明:
如果你說的這種有規律的循環間隔注重的是「調取」後台數據的時候完成,那麼需要使用pc表簽的get模式直接執行sql命令,並在sql命令中指定規律性演算法的命令條件,例如:
{pc:get sql="select * from phpcms_news as r where mod(r.id,4) = 0" num="10"}
... ...
{/pc}
以上方法相對來說比較復雜,需要有一定的資料庫命令基礎。當然一般的phpcms標簽沒有這么復雜,也實現不了這么發雜的定製,一般用不著。推薦使用下面第二種...
如果你說的這種有規律的循環間隔注重的是「顯示」的時候實現,也就是數據已經獲取到了,比如從第1條到第10條,然後你想循環判斷顯示出序號是0,4,8條的數據,可以在phpcms的loop標簽循環變數數據是坐下求余判斷即可:
{pc:content action="lists" catid="1" num="10" order="id desc"}
{loop $data $v}
{if $n%4==0}
<li>{$n}<a href="{$v['url']}">{$v['title']}</a></li>
{/if}
{/loop}
{/pc}
PS:第二條的情況比較像我以前回答的問題,可以參考:http://.baidu.com/question/368960660256180724;更多phpcms模板製作方法可以參考官方開發手冊以及iphpcms的視頻教程。
7、PHPCMS循環輸出欄目標題如何實現
很簡單,用pc:content標簽,action設置為category即可。
{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}另送一個我博客「追太陽」中以前一篇文章中的關於獲取無限極欄目的調用方法代碼:
<div id="menu">8、帝國CMS中,php 循環執行sql查詢並輸出
不了解裡面的sql類,所以使用最原始的方法
$sql = "select `classid` from `phome_ecms_123` where `id` in (".$copy.")";這樣就達到目標了
9、phpcms 怎麼循環調用多圖欄位的圖片
不用糾結少年,查詢附件表,別說不知道哦,條件也不用我說吧,contentid為條件,查詢出所有該文章內容的圖片。就可以了,無論你在模板裡面查還是在php文件里寫都可以了