Q - How the value gets in posts_per_page in phpBB ?

Moderator: mindphp

Raja Pdl
PHP VIP Members
PHP VIP Members
โพสต์: 2241
ลงทะเบียนเมื่อ: 27/05/2024 9:50 am

Q - How the value gets in posts_per_page in phpBB ?

โพสต์ที่ยังไม่ได้อ่าน โดย Raja Pdl »

I am trying to set on one page has how much limit, and it does not support in phpBB

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

$start = $request->variable('start', 0);
$limit = 15;

    $sql_ary = array(
        'SELECT' => '*',
        'FROM' => array(
            'tools_resistor_calculator' => 'r',
        ),
        'ORDER_BY' => 'id DESC',
    );

    $sql2 = $db->sql_build_query('SELECT', $sql_ary);
    $result2 = $db->sql_query_limit($sql2, $limit, $start);
 
 ------- other codes ----------
 
    // Generate the pagination
    $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_forums, $limit, $start);

since , the $limit format is wrong, I've to work with $config. So, I changed like this

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

$start = $request->variable('start', 0);
$per_page = $config['posts_per_page'];

    $sql_ary = array(
        'SELECT' => '*',
        'FROM' => array(
            'tools_resistor_calculator' => 'r',
        ),
        'ORDER_BY' => 'id DESC',
    );

    $sql2 = $db->sql_build_query('SELECT', $sql_ary);
    $result2 = $db->sql_query_limit($sql2, $per_page, $start);
 
 ------- other codes ----------
 
    // Generate the pagination
    $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_forums, $per_page, $start);

and now it is showing 10 rows per page

I want to know how it gets the value of 10?
Since I've not declared to show 10 anywhere.
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 24206
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: Q - How the value gets in posts_per_page in phpBB ?

โพสต์ที่ยังไม่ได้อ่าน โดย eange08 »

Raja Pdl เขียน: 12/06/2024 7:38 pm I am trying to set on one page has how much limit, and it does not support in phpBB

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

$start = $request->variable('start', 0);
$limit = 15;

    $sql_ary = array(
        'SELECT' => '*',
        'FROM' => array(
            'tools_resistor_calculator' => 'r',
        ),
        'ORDER_BY' => 'id DESC',
    );

    $sql2 = $db->sql_build_query('SELECT', $sql_ary);
    $result2 = $db->sql_query_limit($sql2, $limit, $start);
 
 ------- other codes ----------
 
    // Generate the pagination
    $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_forums, $limit, $start);

since , the $limit format is wrong, I've to work with $config. So, I changed like this

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

$start = $request->variable('start', 0);
$per_page = $config['posts_per_page'];

    $sql_ary = array(
        'SELECT' => '*',
        'FROM' => array(
            'tools_resistor_calculator' => 'r',
        ),
        'ORDER_BY' => 'id DESC',
    );

    $sql2 = $db->sql_build_query('SELECT', $sql_ary);
    $result2 = $db->sql_query_limit($sql2, $per_page, $start);
 
 ------- other codes ----------
 
    // Generate the pagination
    $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_forums, $per_page, $start);

and now it is showing 10 rows per page

I want to know how it gets the value of 10?
Since I've not declared to show 10 anywhere.
$config['posts_per_page'] means what, and where should it be configured in phpBB 3.3?
ภาพประจำตัวสมาชิก
eange08
PHP VIP Members
PHP VIP Members
โพสต์: 24206
ลงทะเบียนเมื่อ: 22/12/2020 10:09 am

Re: Q - How the value gets in posts_per_page in phpBB ?

โพสต์ที่ยังไม่ได้อ่าน โดย eange08 »

In phpBB 3.3, $config['posts_per_page'] refers to the setting that controls the number of posts displayed per page in a forum thread. To change this setting, follow these steps:

Log in to the Admin Control Panel (ACP):

Log in to your forum with an administrator account.
Click on the "Administration Control Panel" (ACP) link, usually found at the bottom of the page.
Navigate to the Display Settings:

Once in the ACP, go to the General tab.
In the left menu, click on Board Configuration, then select Board Features.
Adjust the Posts Per Page Setting:

Look for a section called Pagination settings or Post settings.
Find the setting named Posts per page.
Enter the number of posts you want to display per page (for example, 10 if you want 10 posts per page).
Save Your Changes:

After making your adjustments, click the Submit button to save the changes.
This process allows you to set the number of posts displayed on each page of a forum thread in phpBB 3.3 according to your preference.

Summary of Steps:
Log in to the ACP.
Go to General -> Board Configuration -> Board Features.
Adjust the Posts per page setting.
Save your changes.
Raja Pdl
PHP VIP Members
PHP VIP Members
โพสต์: 2241
ลงทะเบียนเมื่อ: 27/05/2024 9:50 am

Re: Q - How the value gets in posts_per_page in phpBB ?

โพสต์ที่ยังไม่ได้อ่าน โดย Raja Pdl »

Ok, Thank you. I understand now and changed settings in ACP > General -> Board Configuration -> Post Settings and changed posts per page.
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 4