Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
How to show only x numer of news from a category?

 
Reply to topic    Forum Index » Help View previous topic
View next topic
How to show only x numer of news from a category?
Author Message
acateoN



Joined: 12 Feb 2008
Posts: 47

Post How to show only x numer of news from a category? Reply with quote
Tried to figure it out but I'm not smart enoguht : P
I want to show for example only 20 news from categori 1 how do I do that?

_________________
www.xpl.se - Runs under CNR
Sun May 25, 2008 8:13 pm View user's profile Send private message
Guest








Please login to hide the ads.

dijares



Joined: 11 Nov 2006
Posts: 40

Post anyone know? Reply with quote
I need the same thing. For instance, when one of the categories is used in my site, it draws all of the news from that certain category, which can be hundreds of posts, which is another thing that's helping to kill my bandwidth.

Is there any type of plug-in/code that we can add to help the categories themselves to add the pagination at the bottom?

Thanks!
Wed May 28, 2008 6:45 pm View user's profile Send private message Visit poster's website
SolidSnake2003



Joined: 31 Jul 2007
Posts: 54

Post Reply with quote
You need to specify it in your include code

<?
category 'idgoeshere';
number '20'

include 'cutepathgoeshere'
?>
Thu May 29, 2008 5:29 pm View user's profile Send private message
acateoN



Joined: 12 Feb 2008
Posts: 47

Post Reply with quote
Thanks a lot!

_________________
www.xpl.se - Runs under CNR
Thu May 29, 2008 8:50 pm View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
Quote:
I want to show for example only 20 news from categori 1 how do I do that?


If I'm understanding you correctly all you need to do is this:

Code:
<?php
$number = "20";
$category = "1";
include("admin/show_news.php");
?>


If you don't put your cnr in /admin on your sites then change that as necessary to match your site.

There are 3 variables like that which are very important... $number, $template, $category.. remember them! lol

p.s. SolidSnake what's up with that sloppy code above? lol I know you know better than that.

Quote:
Thanks a lot!


You got it all situated then?

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Fri May 30, 2008 12:31 am View user's profile Send private message Visit poster's website AIM Address
dijares



Joined: 11 Nov 2006
Posts: 40

Post Reply with quote
This isn't what I mean...

When someone clicks within a category, it brings up all articles within that category. I'm not talking about the actual link to that assigned page. I know this sounds confusing...

My category, for instance, is Half-Blood Prince Movie...

The actual assigned page is here:

http://www.harrypotterspage.com/hbp.php

This is limited to 15 posts, I think, as I did the PHP as shown above.

But when looking at the posts, you see the categories within each post. If someone clicks on the category (shown as half-blood-prince-movie) that I've assigned this as within my categories in CNR, it shows ALL of the articles, which really drains my bandwidth. This is the link to the category:

http://harrypotterspage.com/news.php/category/half-blood-prince-movie

See the difference?

How can I make it so when the actual category is clicked on it will only show 15 articles and give the pagination?

Thanks!
Fri May 30, 2008 2:33 pm View user's profile Send private message Visit poster's website
Torstein



Joined: 03 Aug 2006
Posts: 119

Post Reply with quote
Put $number = "20"; within the include you use in the news.php file (you've probably just put it in the include code on the hbp.php page).

Example of this in action with categories: http://buekorpsene.com/index.php/category/forsiden/draeggens . As you can see from the example the $number variable works even when displaying categories.
Fri May 30, 2008 3:33 pm View user's profile Send private message
dijares



Joined: 11 Nov 2006
Posts: 40

Post Reply with quote
Torstein wrote:
Put $number = "20"; within the include you use in the news.php file (you've probably just put it in the include code on the hbp.php page).

Example of this in action with categories: http://buekorpsene.com/index.php/category/forsiden/draeggens . As you can see from the example the $number variable works even when displaying categories.


Yes, yes, yes! Woohoo! I knew it had to be something like that....

Thanks much!

It's working!

You've just saved me loads of money! Smile Thanks!
Fri May 30, 2008 6:18 pm View user's profile Send private message Visit poster's website
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
!?

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Mon Jun 02, 2008 7:58 am View user's profile Send private message Visit poster's website AIM Address
acateoN



Joined: 12 Feb 2008
Posts: 47

Post Reply with quote
It didn't quite work as I had planed. It shows X number of news alright but theres a pagination at the bottom.. Is it possible to get rid of that without making a new template?

_________________
www.xpl.se - Runs under CNR
Tue Jun 03, 2008 12:27 pm View user's profile Send private message
Mystic2010



Joined: 10 Jan 2007
Posts: 51

Post Reply with quote
Clear the news pagination section of your template?
What this does however, is show only the latest X articles, being unable to view the older articles..
Tue Jun 03, 2008 3:42 pm View user's profile Send private message
acateoN



Joined: 12 Feb 2008
Posts: 47

Post Reply with quote
Yeah thats not exactly what I want... I simply want a to show a top 20 news page... With the same style as my default page. Perhaps making an extra template is the easiest way to go...

_________________
www.xpl.se - Runs under CNR
Tue Jun 03, 2008 7:48 pm View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 2027
Location: US

Post Reply with quote
Quote:
Perhaps making an extra template is the easiest way to go...


Perhaps.. I usually make lots of templates..

_________________
www.scodal.com is an example of cnr as a social forum - www.scottdizzle.com is an example of cnr as a personal website to share whatever cool stuff i feel like. i have another, but it's nsfw. pm me Wink
Wed Jun 04, 2008 5:11 am View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:    
Reply to topic    Forum Index » Help All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.