สอบถามวิธีแก้ไข html ใน pagination ของเทมเพลตยังไงครับ

ถามตอบ ปัญหาการพัฒนา Extension ไม่ว่าจะเป็น Module plugin Component หรือ แม้แต่ template การปรับแต่งโค้ด Joomla ต่างๆ ทุกเวอร์ชั่น 1.5 2.5 หรือ 3.x

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
Thanapoom1514
PHP VIP Members
PHP VIP Members
โพสต์: 4329
ลงทะเบียนเมื่อ: 04/07/2022 9:46 am

สอบถามวิธีแก้ไข html ใน pagination ของเทมเพลตยังไงครับ

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

ต้องการจะปรับ html ใน pagination ของเทมเพลตครับ ซึ่งในตอนนี้ pagination มันแสดง list ครับ ซึ่งผมต้องการที่จะปรับ html และเพิ่ม class ของ bootstrap 5 มาใช้ครับ
Joomla Development-1.png
Joomla Development-1.png (5.7 KiB) Viewed 966 times
โค้ดที่แสดง pagination ที่โฟลเดอร์ com_tags ในส่วนของ html เทมเพลต

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

<?php echo $this->pagination->getPagesLinks(); ?>
:gfb:
ภาพประจำตัวสมาชิก
tsukasaz
PHP VIP Members
PHP VIP Members
โพสต์: 21911
ลงทะเบียนเมื่อ: 18/04/2012 9:39 am

Re: สอบถามวิธีแก้ไข html ใน pagination ของเทมเพลตยังไงครับ

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

ไฟล์นี้ครับ

Joomla Development-1.png
Joomla Development-1.png (124.09 KiB) Viewed 957 times
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
ภาพประจำตัวสมาชิก
Thanapoom1514
PHP VIP Members
PHP VIP Members
โพสต์: 4329
ลงทะเบียนเมื่อ: 04/07/2022 9:46 am

Re: สอบถามวิธีแก้ไข html ใน pagination ของเทมเพลตยังไงครับ

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

ได้แล้วครับ
Joomla Development-1.png
Joomla Development-1.png (4.1 KiB) Viewed 945 times
โค้ดที่ปรับ pagination.php ครับ

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

function pagination_item_active(&$item)
{
	$class = ' class="page-item"';

	// Check for "Start" item
	if ($item->text === JText::_('JLIB_HTML_START'))
	{
		$display = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M493.6 445c-11.2 5.3-24.5 3.6-34.1-4.4L288 297.7V416c0 12.4-7.2 23.7-18.4 29s-24.5 3.6-34.1-4.4L64 297.7V416c0 17.7-14.3 32-32 32s-32-14.3-32-32V96C0 78.3 14.3 64 32 64s32 14.3 32 32V214.3L235.5 71.4c9.5-7.9 22.8-9.7 34.1-4.4S288 83.6 288 96V214.3L459.5 71.4c9.5-7.9 22.8-9.7 34.1-4.4S512 83.6 512 96V416c0 12.4-7.2 23.7-18.4 29z"/></svg>';
		$aria    = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
	}

	// Check for "Prev" item
	if ($item->text === JText::_('JPREV'))
	{
		$display = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3V256v41.7L459.5 440.6zM256 352V256 128 96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V352z"/></svg>';
		$aria    = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
	}

	// Check for "Next" item
	if ($item->text === JText::_('JNEXT'))
	{
		$display = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96C0 83.6 7.2 72.3 18.4 67s24.5-3.6 34.1 4.4L224 214.3V256v41.7L52.5 440.6zM256 352V256 128 96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4s-18.4-16.6-18.4-29V352z"/></svg>';
		$aria    = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
	}

	// Check for "End" item
	if ($item->text === JText::_('JLIB_HTML_END'))
	{
		$display = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M18.4 445c11.2 5.3 24.5 3.6 34.1-4.4L224 297.7V416c0 12.4 7.2 23.7 18.4 29s24.5 3.6 34.1-4.4L448 297.7V416c0 17.7 14.3 32 32 32s32-14.3 32-32V96c0-17.7-14.3-32-32-32s-32 14.3-32 32V214.3L276.5 71.4c-9.5-7.9-22.8-9.7-34.1-4.4S224 83.6 224 96V214.3L52.5 71.4c-9.5-7.9-22.8-9.7-34.1-4.4S0 83.6 0 96V416c0 12.4 7.2 23.7 18.4 29z"/></svg>';
		$aria    = JText::sprintf('JLIB_HTML_GOTO_POSITION', strtolower($item->text));
	}

	// If the display object isn't set already, just render the item with its text
	if (!isset($display))
	{
		$display = $item->text;
		$aria    = JText::sprintf('JLIB_HTML_GOTO_PAGE', $item->text);
		$class   = ' class="page-item hidden-phone"';
	}

	return '<li' . $class . '><a title="' . $item->text . '" href="' . $item->link . '" class="page-link" aria-label="' . $aria . '">' . $display . '</a></li>';

}

/**
 * Renders an inactive item in the pagination block
 *
 * @param   JPaginationObject  $item  The current pagination object
 *
 * @return  string  HTML markup for inactive item
 *
 * @since   3.0
 */
function pagination_item_inactive(&$item)
{
	// Check for "Start" item
	if ($item->text === JText::_('JLIB_HTML_START'))
	{
		return '<li class="page-item disabled"><a class="page-link">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M493.6 445c-11.2 5.3-24.5 3.6-34.1-4.4L288 297.7V416c0 12.4-7.2 23.7-18.4 29s-24.5 3.6-34.1-4.4L64 297.7V416c0 17.7-14.3 32-32 32s-32-14.3-32-32V96C0 78.3 14.3 64 32 64s32 14.3 32 32V214.3L235.5 71.4c9.5-7.9 22.8-9.7 34.1-4.4S288 83.6 288 96V214.3L459.5 71.4c9.5-7.9 22.8-9.7 34.1-4.4S512 83.6 512 96V416c0 12.4-7.2 23.7-18.4 29z"/></svg>
		</a></li>';
	}

	// Check for "Prev" item
	if ($item->text === JText::_('JPREV'))
	{
		return '<li class="page-item disabled"><a class="page-link">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M459.5 440.6c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4L288 214.3V256v41.7L459.5 440.6zM256 352V256 128 96c0-12.4-7.2-23.7-18.4-29s-24.5-3.6-34.1 4.4l-192 160C4.2 237.5 0 246.5 0 256s4.2 18.5 11.5 24.6l192 160c9.5 7.9 22.8 9.7 34.1 4.4s18.4-16.6 18.4-29V352z"/></svg>
		</a></li>';
	}

	// Check for "Next" item
	if ($item->text === JText::_('JNEXT'))
	{
		return '<li class="page-item disabled"><a class="page-link">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M52.5 440.6c-9.5 7.9-22.8 9.7-34.1 4.4S0 428.4 0 416V96C0 83.6 7.2 72.3 18.4 67s24.5-3.6 34.1 4.4L224 214.3V256v41.7L52.5 440.6zM256 352V256 128 96c0-12.4 7.2-23.7 18.4-29s24.5-3.6 34.1 4.4l192 160c7.3 6.1 11.5 15.1 11.5 24.6s-4.2 18.5-11.5 24.6l-192 160c-9.5 7.9-22.8 9.7-34.1 4.4s-18.4-16.6-18.4-29V352z"/></svg>
		</a></li>';
	}

	// Check for "End" item
	if ($item->text === JText::_('JLIB_HTML_END'))
	{
		return '<li class="page-item disabled"><a class="page-link">
		<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10"><path d="M18.4 445c11.2 5.3 24.5 3.6 34.1-4.4L224 297.7V416c0 12.4 7.2 23.7 18.4 29s24.5 3.6 34.1-4.4L448 297.7V416c0 17.7 14.3 32 32 32s32-14.3 32-32V96c0-17.7-14.3-32-32-32s-32 14.3-32 32V214.3L276.5 71.4c-9.5-7.9-22.8-9.7-34.1-4.4S224 83.6 224 96V214.3L52.5 71.4c-9.5-7.9-22.8-9.7-34.1-4.4S0 83.6 0 96V416c0 12.4 7.2 23.7 18.4 29z"/></svg>
		</a></li>';
	}

	// Check if the item is the active page
	if (isset($item->active) && $item->active)
	{
		$aria = JText::sprintf('JLIB_HTML_PAGE_CURRENT', $item->text);

		return '<li class="page-item active hidden-phone"><a class="page-link" aria-current="true" aria-label="' . $aria . '">' . $item->text . '</a></li>';
	}

	// Doesn't match any other condition, render a normal item
	return '<li class="page-item disabled hidden-phone"><a class="page-link">' . $item->text . '</a></li>';
}
:gfb:
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

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

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