2013-01-07 37 views
-2

如何將顯示帖子摘錄的主頁分成不同的頁面,每頁只顯示5個摘錄,並有鏈接顯示舊帖子? 像這樣: 拆分主頁,每頁顯示5條信息

+0

工作流沒看懂。 –

+0

我試圖搜索谷歌,但沒有找到答案,所以我在這裏問。我知道這似乎很愚蠢,但我不知道該怎麼做。 –

回答

0

你需要尋找到Pagination 你的腳本將有類似這樣的

<?php 
$totalpost = 100; 
$currentpost = 0; 
$pagelimit = 5; 
$current_page = 0; 
$current_page_count = 0; 
$totalpages = $totalpost/$pagelimit; 
while($currentpost < $totalpost){ 
    $current_page_count = 0; 
    while($current_page_count < $pagelimit){ 
     echo " $currentpost "; 
     $currentpost++; 
     $current_page_count++; 
    } 

    echo " <br> page $current_page <br>"; 
    $current_page++; 
} 
?>