効果要件のため、Dedecmsはより多くの機能をロードする必要があり、半日を費やしてようやく到着しました。
まず、/plus/ファイルの下にリスト_case.phpファイルを作成します。
<? PHPは
/**
*
* チャンネル一覧/チャンネル動的ページ
*
* @version $Id list.php 1 15 38 2010年7月8日Z tianya $
* @packageさん DedeCMS.Site
* @copyrightさん。 right
* @license(ライセンス) http://help.dedecms.com/usersguide/license.html
* @linkさん http://www.dedecms.com
*/
require_once dirname____."/../ include/common.inc.php ";if isset $_GET [ajax]{
$eid = isset $_GET [eid] intval $_GET [typeid] 0;//渡された分類ID
$page = isset $_GET [page] intval $_GET [page] 0;//ページ番号
$pagesize = isset $_GET [pagesize] intval $_GET [pagesize] 15;//1ページあたりの数、つまり一度にロードされるデータ数
$start = $page>0 $page-1制限条件の最初のパラメータです。
$typesql = $typeid“WHERE typeid=$typeid”“;//これはフロントページがウォーターフォールのロードを実装するために使用されます。フロントページのロードデータは分類されないので、判断する必要があります。
$total_sql = “SELECT COUNT id as num FROM `#@__archives` $typesql”;
$temp = $dsql->GetOne $total_sql;
$total = 0;//データの総数
$Load_num =0;
if is_${
$load_num = round $temp[num]-15/$pagesize;//デフォルトで既にロードされているため、ロードする回数
$total = $[];
}
$sql = “SELECT a.* t.typedir t.typename t.isdefault t.defaultname t.namerule
t.namerule2 t.ist.moresite t.siteurl t.sitepath
FROM `#@__archives` as a JOIN `#@__arctype` AS t ON a. eid = t.id $typesql ORDER BY id DESC LIMIT $start $pagesize ";
//echo “$SQL”;
$dsql->SetQuery $sql;
$dsql->Execute list;
$statu = 0;//データはありません。
$data =;
$index = 0;
while $row = $dsql->GetArray 'list'{
$row [info] = $row [info] = $row [infos]=_sub $row [description] 160;
$row [id] = $row [id];
$row [filename] = $row [arcurl] = GetFileUrl $row [id]
$row [typeid]、$row [senddate]、$row [title]、$row [ismake]、
$row [arcrank]、$row [namerule]、$row [typedir]、$row [money]、
$row [filename]、$row [moresite]、$row [siteurl]、$row [sitepath];
$row [eurl] = GetTypeUrl $row [eid]$row [edir]
$row [is]$row [name]$row [is]
$row [namerule2]、$row [moresite]、$row [siteurl]、$row [sitepath];
if $row [litpic]===-||$row [litpic]=='{
$row [litpic] = $GLOBALS [cfg_cmspath]./ images/defaultpic.gif;
}
If! preg_match #^http\/\/#i "$row [litpic]&&$GLOBALS [cfg_multi_site]== Y {
$row [litpic] = $GLOBALS [cfg_mainsite].$ row [litpic];
}
$row[picname] = $row[litpic];//サムネイル
$row [stime] = GetMK $row [date];
$row [elink] ="<a href ='.$ row [eurl].>.$ row [typename]。</a>;//分類チェーン
$row[fulltitle] = $row[title];//完全なタイトル
$row[shorttitle] = $row[shorttitle];//サブタイトル
$row[title] = cn_substr $row[title] 60;//傍受後のタイトル
$data[$index] = $row;
$index++;
}
If! empty $data {
$statu = 1;//データがある
}
$=$data;
echo json_encode $result;//データを返す
exit exit nParticle nParticle;
}
/**
*
* チャンネル一覧/チャンネル動的ページ
*
* @version $Id list.php 1 15 38 2010年7月8日Z tianya $
* @packageさん DedeCMS.Site
* @copyrightさん。 right
* @license(ライセンス) http://help.dedecms.com/usersguide/license.html
* @linkさん http://www.dedecms.com
*/
require_once dirname____."/../ include/common.inc.php ";if isset $_GET [ajax]{
$eid = isset $_GET [eid] intval $_GET [typeid] 0;//渡された分類ID
$page = isset $_GET [page] intval $_GET [page] 0;//ページ番号
$pagesize = isset $_GET [pagesize] intval $_GET [pagesize] 15;//1ページあたりの数、つまり一度にロードされるデータ数
$start = $page>0 $page-1制限条件の最初のパラメータです。
$typesql = $typeid“WHERE typeid=$typeid”“;//これはフロントページがウォーターフォールのロードを実装するために使用されます。フロントページのロードデータは分類されないので、判断する必要があります。
$total_sql = “SELECT COUNT id as num FROM `#@__archives` $typesql”;
$temp = $dsql->GetOne $total_sql;
$total = 0;//データの総数
$Load_num =0;
if is_${
$load_num = round $temp[num]-15/$pagesize;//デフォルトで既にロードされているため、ロードする回数
$total = $[];
}
$sql = “SELECT a.* t.typedir t.typename t.isdefault t.defaultname t.namerule
t.namerule2 t.ist.moresite t.siteurl t.sitepath
FROM `#@__archives` as a JOIN `#@__arctype` AS t ON a. eid = t.id $typesql ORDER BY id DESC LIMIT $start $pagesize ";
//echo “$SQL”;
$dsql->SetQuery $sql;
$dsql->Execute list;
$statu = 0;//データはありません。
$data =;
$index = 0;
while $row = $dsql->GetArray 'list'{
$row [info] = $row [info] = $row [infos]=_sub $row [description] 160;
$row [id] = $row [id];
$row [filename] = $row [arcurl] = GetFileUrl $row [id]
$row [typeid]、$row [senddate]、$row [title]、$row [ismake]、
$row [arcrank]、$row [namerule]、$row [typedir]、$row [money]、
$row [filename]、$row [moresite]、$row [siteurl]、$row [sitepath];
$row [eurl] = GetTypeUrl $row [eid]$row [edir]
$row [is]$row [name]$row [is]
$row [namerule2]、$row [moresite]、$row [siteurl]、$row [sitepath];
if $row [litpic]===-||$row [litpic]=='{
$row [litpic] = $GLOBALS [cfg_cmspath]./ images/defaultpic.gif;
}
If! preg_match #^http\/\/#i "$row [litpic]&&$GLOBALS [cfg_multi_site]== Y {
$row [litpic] = $GLOBALS [cfg_mainsite].$ row [litpic];
}
$row[picname] = $row[litpic];//サムネイル
$row [stime] = GetMK $row [date];
$row [elink] ="<a href ='.$ row [eurl].>.$ row [typename]。</a>;//分類チェーン
$row[fulltitle] = $row[title];//完全なタイトル
$row[shorttitle] = $row[shorttitle];//サブタイトル
$row[title] = cn_substr $row[title] 60;//傍受後のタイトル
$data[$index] = $row;
$index++;
}
If! empty $data {
$statu = 1;//データがある
}
$=$data;
echo json_encode $result;//データを返す
exit exit nParticle nParticle;
}
表示するページにAjaxコードを貼り付けます。
<div class='remodal' data-remodal-id ='modal'>
<ul id= caseLi ">
{dede arclist typeid =
<li><a href="[field arcurl/]"><img src="[field litpic/]" alt="[field title/]" height="500"/></a></li>
{/dedearclist}</ul>
<button id= loadMore "style=" clear both;width 80px; height 30px; border none; background #c2272b;line-height 30px; color #fff; margin-top 20px;">もっとロード</button>
</div>
<script type=“text/javascript”>
clickNum = 1;
$#loadMore ".click function {
clickNum +=1;
$.ajax {
url/plus/list_case. php
data {typeid 5 page clickNum pagesize 10 ajax pullcase}
dataType json
suess function data {
$.each data[0] function idx {
$#caseLi ".append <<li>a href="+ item.arcurl +'"><img src="+ item.picname +'"alt="+ item.title +'''height="500"/</a></li>>;
});
}
});
};</script> bloggerテストの後、理解できないブロガーがいる場合は、以下に返信することができます。
<ul id= caseLi ">
{dede arclist typeid =
<li><a href="[field arcurl/]"><img src="[field litpic/]" alt="[field title/]" height="500"/></a></li>
{/dedearclist}</ul>
<button id= loadMore "style=" clear both;width 80px; height 30px; border none; background #c2272b;line-height 30px; color #fff; margin-top 20px;">もっとロード</button>
</div>
<script type=“text/javascript”>
clickNum = 1;
$#loadMore ".click function {
clickNum +=1;
$.ajax {
url/plus/list_case. php
data {typeid 5 page clickNum pagesize 10 ajax pullcase}
dataType json
suess function data {
$.each data[0] function idx {
$#caseLi ".append <<li>a href="+ item.arcurl +'"><img src="+ item.picname +'"alt="+ item.title +'''height="500"/</a></li>>;
});
}
});
};</script> bloggerテストの後、理解できないブロガーがいる場合は、以下に返信することができます。