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

SEO Maintenance, Jadi Nomor Satu

SEO atau Search Engine Optimization adalah cara agar website yang kita miliki bisa tampil di halaman pertama pencarian Google. Lewat pengalaman kami 10 tahun di industri website dan online.

Read more

blog image

Website vs Medial Sosial vs Aplikasi Mobile

Sekarang ini sudah menjadi sangat umum apabila sebuah brand atau perusahaan, memiliki sebuah eksistensi di dunia digital atau online atau lebih tepatnya saya sebut sebagai "internet". Namun sebetulnya saat ini, anda bisa memilih antara memiliki salah satu dari antara : website, media sosial, dan atau aplikasi mobile.

Read more

Our Team

We’ve been building websites and designs for many clients since 2009. Passionate people is one of our key of success in this business.
team

Yofie Setiawan

Creative Director
team

Prima Yogi Loviniltra

UI/UX Designer
team

Khantri Iswahyudi

Front-End Developer
team

Aprilia Ayu Lestari

Web Administrator

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!

 

Products & Services

Beside of offering our services in web design and development, we also build products and services that usually fits to many corporate companies to help their business growth.

Contact Us

PT. Yopdesign Creative Indonesia
Green Village 5C31
Cipondoh, Tangerang
Banten 15145, Indonesia

+62 859 5959 8224
yofie@yopdesign.com

CONTACT US

 

DOWNLOADS

whatsapp whatsapp