Support Forums

Count and show number of listings in showlistings.tpl

This is a discussion on Count and show number of listings in showlistings.tpl within the Technical Support forums, part of the Technical Support Forums category; Hi all, What im looking to acheive is at the top of the showlistings.tpl page, to show the number of ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 05-06-2009, 07:27 AM   #1
Customer
 
jason1971's Avatar
 
Join Date: Jan 2009
Location: England
Posts: 147
Rep Power: 11
jason1971 is on a distinguished road
Default Count and show number of listings in showlistings.tpl

Hi all,

What im looking to acheive is at the top of the showlistings.tpl page, to show the number of items within that chosen category.

So it would read something like: There are 56 caravans for sale

Any pearls of wisdom welcome

Many Many thanks in advance

Jason
__________________
v4.1.8 Hosted - using Templatecodes neo2- green template
jason1971 is offline  
Old 05-06-2009, 09:39 AM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,352
Rep Power: 134
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

You should be able to use the smarty vaariable {$numrows} in the showlistings.tpl
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 05-07-2009, 01:51 AM   #3
Customer
 
jason1971's Avatar
 
Join Date: Jan 2009
Location: England
Posts: 147
Rep Power: 11
jason1971 is on a distinguished road
Default

Many Thanks Larrry
__________________
v4.1.8 Hosted - using Templatecodes neo2- green template
jason1971 is offline  
Old 05-07-2009, 04:29 AM   #4
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,082
Rep Power: 33
bowers01 is on a distinguished road
Default

Quote:
Originally Posted by Lhotch
{$numrows}
Thats what i use but does anyone know how to make it show something like this
Quote:
Showing 10-20 of 45 Listings
Thanks,
Nick
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template
bowers01 is offline  
Old 05-07-2009, 09:26 AM   #5
curmudgeon
 
Join Date: Mar 2006
Posts: 5,352
Rep Power: 134
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by bowers01
Thats what i use but does anyone know how to make it show something like this


Thanks,
Nick
There is a smarty var called {$pageNum} as well which displays the page you are on.

If you have your site to display 10 ads per page then you should be able to do some basic math to display what you want.

if you on the second page....

pagenum times 10 should give you the starting ad number

{$pageNum * 10} would give you the number 20. You probably need to add some logic to detrmine if you on the first page though otherwise ti will say showing 10-10.

add 10 to the above math to get page displayed max ad number

{$pageNum *10+10}

BUT what if you are on page 4 and have only 45 ad? It would say 40-50 of 45 so you need to do some more math to check the values.


Showing
{if $pageNum =="1"}
{$pageNum}
{else}
{$pageNum * 10}
{/if}
-
{if $pageNum *10+10 > $numrows}
{$numrows}
{else}
{$pageNum *10+10 }
{/if}
of
{$numrows}
listings.

The above isnt testd but should give you a start.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 05-08-2009, 04:00 AM   #6
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,082
Rep Power: 33
bowers01 is on a distinguished road
Default

This seems to work well.
Code:
Showing 
{if $pageNum =="1"}
{$pageNum} - 15
{else}
{$pageNum*15-15} - 
{/if}
{if $pageNum =="1"}
{else}
{if $pageNum*15 > $numrows}
{$numrows} 
{else} 
{$pageNum*15+15-15 } 
{/if} 
{/if}
of 
{$numrows} 
listings.
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template
bowers01 is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show the number of listings in subcategories? AHTOXA Modules / Plugins / Modifications 12 06-01-2009 02:35 PM
How to display a count of the number of ads in a category j890432m Technical Support 12 07-15-2008 04:19 PM


All times are GMT -4. The time now is 04:50 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0