Blog Joomla How to Change Pagination Style on Joomla or Sobi2

How to Change Pagination Style on Joomla or Sobi2

I'll share about how to change pagination style on Joomla or Sobi2. I've been troubled of how my website pagination looked. At first, i thought i need to fix the codes at Sobi2 component, but in fact, i need to fix the codes on Joomla Core. FYI, i still use Joomla 1.5. The problem is my website pagination was showing too much links 1 to 10, which looked awful on my web design layout because it turns out to be 2 lines. So in order to make it in 1 line, i need to reduce the pagination links to only showing 1 to 4.

So i just need to edit the "libraries\joomla\html\pagination.php".

Find below scripts...

{xtypo_code}$displayedPages = 10;
$this->set( 'pages.start', (floor(($this->get('pages.current') -1) / $displayedPages)) * $displayedPages +1);
if ($this->get('pages.start') + $displayedPages -1 < $this->get('pages.total')) {
$this->set( 'pages.stop', $this->get('pages.start') + $displayedPages -1);
} else {
$this->set( 'pages.stop', $this->get('pages.total'));
}

// If we are viewing all records set the view all flag to true
if ($this->limit == $total) {
$this->_viewall = true;
}{/xtypo_code}

Replace it to...

{xtypo_code}$displayedPages = 4; // not less than 4 and ONLY round numbers like 10, 12, 14...
$this->set( 'pages.start', $this->get('pages.current') - ($displayedPages / 2));
$this->set( 'pages.stop', $this->get('pages.current') + ($displayedPages / 2));
if ($this->get('pages.start') < 1) {
$this->set( 'pages.start', 1);
if ($this->get('pages.total') >= $displayedPages) {
$this->set( 'pages.stop', $this->get('pages.current') + ($displayedPages - $this->get('pages.current')));
}
else {
$this->set( 'pages.stop', $this->get('pages.total'));
}
}
else if ($this->get('pages.start') >= 1) {
if ($this->get('pages.total') <= $displayedPages) {
$this->set( 'pages.start', 1);
$this->set( 'pages.stop', $this->get('pages.total'));
}
else if ($this->get('pages.total') > $displayedPages) {
if ( ($this->get('pages.total') - $this->get('pages.current')) < ($displayedPages / 2) ){
$this->set( 'pages.start', $this->get('pages.current') - ( ($displayedPages - 1) - ($this->get('pages.total') - $this->get('pages.current'))) );
$this->set( 'pages.stop', $this->get('pages.total'));
}
}
}{/xtypo_code}

In my case, i only need to show 4 links, so on "$displayedPages = 4;" i putted there "4". You can change it to however you want, based on your needs.

You can check the result of my work at garasi24.com.

Source : forum.joomla.org

Blog

blog image

Mengapa Web Maintenance Penting?

Kami telah menjalankan bisnis web design dan development sejak tahun 2009. Sekian lama perjalanan kami, memberikan kami pengalaman bekerja sama dengan berbagai jenis client yang datang dari berbagai macam jenis background bisnis yang berbeda-beda.

Read more

blog image

Spotpunch, Mall Directory App

Spotpunch is simply a Mall Directory app which help people easier in finding and searching for stores inside shopping malls. Until today, we still try to focus data mining from malls that is inside and around Jakarta.

Read more

blog image

Marvel App, Aplikasi Untuk Membuat Prototype Tanpa Coding

Beberapa waktu lalu saya diperkenalkan dengan sebuah aplikasi yang ternyata sesuai dengan yang selama ini saya cari dan belum ketemu. Aplikasi yang cocok untuk kalian yang punya bakat design, namun lemah di coding, seperti saya. Marvel App bisa membantu membuat...

Read more

blog image

Firefox Quantum, Download dan Rasakan Kecepatannya!

Mozilla baru saja meluncurkan Firefox Quantum, browser Firefox yang menggunakan engine baru. Mozilla juga menyajikan konsep design UI yang baru yang disebut sebagai Photon. Anda tidak percaya? Silahkan coba Download Firefox Quantum dan rasakan perbedaannya!

Read more

Hello!

My name is Yofie Setiawan, I manage a team of web designers and web developers based in Jakarta, Indonesia. We are experts in building websites with Joomla CMS using Responsive Web Design technology. We also able to help you build mobile apps for Android and iOS. We focus in web design and development business since 2009. If you are interested in hiring us for a project, Contact Us!

Contact Us

PT. Yopdesign Creative Indonesia
Gedung Tifa, Annex Suite
Jl. Kuningan Barat I No.26
Mampang Prapatan - Jakarta 12710

+62 859 5959 8224
yofie@yopdesign.com

CONTACT US

 

DOWNLOADS

whatsapp whatsapp