| Author |
Message |
acateoN
Joined: 12 Feb 2008 Posts: 47
|
|
How to show only x numer of news from a category? |
|
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 |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
dijares
Joined: 11 Nov 2006 Posts: 40
|
|
anyone know? |
|
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 |
|
 |
SolidSnake2003

Joined: 31 Jul 2007 Posts: 54
|
|
|
|
You need to specify it in your include code
<?
category 'idgoeshere';
number '20'
include 'cutepathgoeshere'
?>
|
|
| Thu May 29, 2008 5:29 pm |
|
 |
acateoN
Joined: 12 Feb 2008 Posts: 47
|
|
|
|
Thanks a lot!
_________________ www.xpl.se - Runs under CNR |
|
| Thu May 29, 2008 8:50 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
 |  | 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:
 |  | <?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.
 |  | 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  |
|
| Fri May 30, 2008 12:31 am |
|
 |
dijares
Joined: 11 Nov 2006 Posts: 40
|
|
|
|
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 |
|
 |
Torstein
Joined: 03 Aug 2006 Posts: 119
|
|
|
|
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 |
|
 |
dijares
Joined: 11 Nov 2006 Posts: 40
|
|
|
|
 |  | 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! Thanks!
|
|
| Fri May 30, 2008 6:18 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
!?
_________________ 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  |
|
| Mon Jun 02, 2008 7:58 am |
|
 |
acateoN
Joined: 12 Feb 2008 Posts: 47
|
|
|
|
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 |
|
 |
Mystic2010
Joined: 10 Jan 2007 Posts: 51
|
|
|
|
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 |
|
 |
acateoN
Joined: 12 Feb 2008 Posts: 47
|
|
|
|
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 |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 2027 Location: US |
|
|
|
 |  | 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  |
|
| Wed Jun 04, 2008 5:11 am |
|
 |
|