ขอวิธีการแบ่งหน้า ด้วย ภาษา php แบบในบอร์ด phpBB ที่มีจุดจุด แล้วไปหน้าสุดท้าย

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: ขอวิธีการแบ่งหน้า ด้วย ภาษา php แบบในบอร์ด phpBB ที่มีจุดจุด แล้วไปหน้าสุดท้าย

Re: Q - ขอวิธีการแบ่งหน้า ด้วย ภาษา phpbb

โดย mindphp » 29/09/2018 4:23 pm

คำถามเกี่ยวกับการเขียนโปรแกรม ด้วย php โพสที่หมวดนี้
https://www.mindphp.com/forums/viewforum.php?f=6

Re: Q - ขอวิธีการแบ่งหน้า ด้วย ภาษา phpbb

โดย Ittichai_chupol » 27/09/2018 6:57 pm

อันนี้คือโคดที่นะครับ ลองนำไป ปรับปรุงดูนะ

ไฟล์ในส่วน php

โค้ด: เลือกทั้งหมด

<?php

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
global $user, $auth, $template, $phpbb_container;

$pagination = $phpbb_container->get('pagination');  

$start = request_var('start', 0);

$limit = 3;

$sql_ary = array(
    'SELECT' => '*',
    'FROM' => array(
        RANKS_TABLE => 'r',
    ),
    
    
);

$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query_limit($sql, $limit, $start);

//print_r($row['rank_id']);
while ($data = $db->sql_fetchrow($result)) {
    $template->assign_block_vars('loop', array(
        'VAR1' => $data['rank_id'],
        'VAR2' => $data['rank_title'],
        'VAR3' => $data['rank_special'],
        'VAR4' => "<hr>",
    ));
}

$sql_ary['SELECT'] = 'COUNT(r.rank_id) as total_forum'; // 6.  COUNT นับจำนวน เพื่อให้ได้จำนวนทั้งหมด
$sql = $db->sql_build_query('SELECT', $sql_ary);


$result = $db->sql_query($sql);
$total_forums = $db->sql_fetchfield('total_forum'); // 7. ประกาศตัวแปร จำนวนทั้งหมด
$db->sql_freeresult($result);
echo $total_forums;


$base_url = 'http://localhost/piecephpbb/custom_test.php?'.$star;
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_forums, $limit, $start);


$template->set_filenames(array(
    'body' => 'home_page2.html')
);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_header($l_title, false);
page_footer();



ไฟล์ ส่วนของ html

โค้ด: เลือกทั้งหมด

 <div class="action-bar">
        <div class="pagination">
            <!-- INCLUDE pagination.html -->
        </div>
    </div>

ขอวิธีการแบ่งหน้า ด้วย ภาษา php แบบในบอร์ด phpBB ที่มีจุดจุด แล้วไปหน้าสุดท้าย

โดย Ittichai_chupol » 27/09/2018 4:51 pm

ผมอยากทราบวิธีการ แบ่งหน้า ด้วยการใช้ภาษา phpbb ให้ได้ดังรูป อยากทราบว่ามีวิธีไหนบาง หรือ ถ้ามีโคดด้วยก็ดีนะครับ
รูปภาพ

ข้างบน