vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > Add-On Modules & Modifications > Module & Modification Discussion & Requests

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2007, 12:06 PM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default News pagination

..snip.. (Lionel has further since reneged)

OK, so for my suggestions..

What News pagination should NOT be. <-- This is what I have for my site currently and doesn't work very well. It's simply a "Back" and "Next" and if there are no more news posts, "Next" is still available and leads you to a blank page.

...snip...

Last edited by jw0ollard; 07-18-2007 at 02:15 AM.
Reply With Quote
  #2  
Old 03-13-2007, 04:50 PM
Lionel Lionel is offline
Senior Member
 
Join Date: Jan 2004
Location: Miami
Posts: 1,040
Default Re: News pagination

I really have no need for this. I am using a news slideshow hack I made to display 150 items grouped by 10 categories and the rest of the page is all GARS

Last edited by Lionel; 03-29-2007 at 07:41 PM.
Reply With Quote
  #3  
Old 03-13-2007, 07:29 PM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

If you changed your mind and don't want to do it now, let me know...

Last edited by jw0ollard; 03-13-2007 at 07:44 PM.
Reply With Quote
  #4  
Old 03-13-2007, 09:42 PM
wil8x wil8x is offline
Member
 
Join Date: Dec 2006
Posts: 42
Default Re: News pagination

Quote:
I really have no need for this. I am using a news slideshow hack I made to display 8 news items and the rest of the page is all GARS
wow, nice scripts.can u share it(Lakay/Haitian News) ?
Reply With Quote
  #5  
Old 03-14-2007, 03:44 AM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

He already has shared it.

But you have to pay for part of the script I think.. so big *thumbs down*

Oh, and apparently you now have to jump through a ring of fire just to get the slideshow script from the original developer, since it had been pirated. No thank you.

Last edited by jw0ollard; 03-14-2007 at 03:48 AM.
Reply With Quote
  #6  
Old 03-14-2007, 10:15 AM
Lionel Lionel is offline
Senior Member
 
Join Date: Jan 2004
Location: Miami
Posts: 1,040
Default Re: News pagination

All you have to do is when you buy it to mention to seller it's for vbulletin. But you are right, stay away from it. This is upsetting to people and to me, and I am already sorry I shared it.
Reply With Quote
  #7  
Old 03-14-2007, 03:30 PM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

Well, I really love your news slideshow.. I just wish the Joomla addon wasn't commercial.

And that's why I really want news pagination!

Or at least someone to help me update the Pagination in this post so that it hides the Previous or Next if there are no news items in that direction.
Reply With Quote
  #8  
Old 03-17-2007, 03:56 PM
tresor tresor is offline
Member
 
Join Date: Nov 2005
Posts: 99
Default Re: News pagination

I want news pagination too, anyone can help me?
Reply With Quote
  #9  
Old 03-22-2007, 06:54 AM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

So anybody willing to tackle this? It's very possible as I've seen it done.. just have no idea how to do it.

Can someone at least update this code here?
Code:
$limit = ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']);

if($_GET['start'] < 0){
header('Location: index.php?page=' . $getpage . '&start=0');
} 
                    if ($_GET['start']==NULL){
                    $start = 0;
                    } else {
                    $start = $_GET['start'];
                    }



$newslimit = 'LIMIT ' . ($start / 2) . ',' . (($start / 2) + $limit);

$previous = ($start + $mod_options['portal_news_maxposts']);
$next = ($start - $mod_options['portal_news_maxposts']);
So that it actually hides the Previous/Next link when there is no news in that direction?

Last edited by jw0ollard; 03-22-2007 at 06:59 AM.
Reply With Quote
  #10  
Old 03-29-2007, 07:38 PM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

Bump? This should be fairly simple for coders..

The code in the post above gives me database errors when you click "Previous" and "Previous" or "Next" do not hide properly when there is no news in that direction.
Reply With Quote
  #11  
Old 06-01-2007, 05:02 PM
succo succo is offline
Member
 
Join Date: Nov 2005
Posts: 85
Default Re: News pagination

he... ok, i did this just today

here is the 'revisited' version:

Code:
$limit = ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']);

if (($_GET['start']==NULL) || ($_GET['start'] < 1)){
	$start = 1;
	} else {
		$start = $_GET['start'];
	}

	$count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "thread WHERE forumid in (".$mod_options['portal_news_forumid'].")");
	$count['count'] = vb_number_format($count['count']);

	$newslimit = 'LIMIT ' . ($start - 1) . ',' . $limit;

	if (($start + $mod_options['portal_news_maxposts']) < $count['count']){
		$previous = ($start + $mod_options['portal_news_maxposts']);
	}
	if ($start > $mod_options['portal_news_maxposts']){
		$next = ($start - $mod_options['portal_news_maxposts']);
	}
this should work, i didn't try it directly in the news module but in a custom module...

the second edit will stay just the same:
Code:
eval('$home[$newsmod[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_news_pagenav') . '";');
and the template will be:
Code:
<div align="center"><if condition="$next">< <a href="index.php?page=$getpage&start=$next">Back</a> | </if><if condition="$previous"><a href="index.php?page=$getpage&start=$previous">Next</a> ></if></div>
<br />
let me know if it works
Reply With Quote
  #12  
Old 06-02-2007, 11:34 AM
convergent convergent is offline
Senior Member
 
Join Date: Jan 2006
Location: NY
Posts: 150
Default Re: News pagination

I may give this one a try... looks like a start in the direction for what I would like to do with my news. This site does it right, in my mind... http://pocketpcthoughts.com/

Main page, news divided by day of the week... then a link at bottom to the archive. The archive page is quite impressive... http://pocketpcthoughts.com/archives.php

If anyone has any ideas on how to do that, I'm all ears...
Reply With Quote
  #13  
Old 06-02-2007, 11:36 AM
convergent convergent is offline
Senior Member
 
Join Date: Jan 2006
Location: NY
Posts: 150
Default Re: News pagination

Could you explain where you are putting these edits???? which files, and where? Thanks. I'll try it.

Quote:
Originally Posted by succo View Post
he... ok, i did this just today

here is the 'revisited' version:

Code:
$limit = ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']);

if (($_GET['start']==NULL) || ($_GET['start'] < 1)){
	$start = 1;
	} else {
		$start = $_GET['start'];
	}

	$count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "thread WHERE forumid in (".$mod_options['portal_news_forumid'].")");
	$count['count'] = vb_number_format($count['count']);

	$newslimit = 'LIMIT ' . ($start - 1) . ',' . $limit;

	if (($start + $mod_options['portal_news_maxposts']) < $count['count']){
		$previous = ($start + $mod_options['portal_news_maxposts']);
	}
	if ($start > $mod_options['portal_news_maxposts']){
		$next = ($start - $mod_options['portal_news_maxposts']);
	}
this should work, i didn't try it directly in the news module but in a custom module...

the second edit will stay just the same:
Code:
eval('$home[$newsmod[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_news_pagenav') . '";');
and the template will be:
Code:
<div align="center"><if condition="$next">< <a href="index.php?page=$getpage&start=$next">Back</a> | </if><if condition="$previous"><a href="index.php?page=$getpage&start=$previous">Next</a> ></if></div>
<br />
let me know if it works
Reply With Quote
  #14  
Old 06-02-2007, 12:46 PM
convergent convergent is offline
Senior Member
 
Join Date: Jan 2006
Location: NY
Posts: 150
Default Re: News pagination

I tried this in the news module and got this result....

PHP Code:
Database error in vBulletin 3.6.5:

Invalid SQL:
SELECT COUNT(*) AS count FROM thread WHERE forumid in (Array);

MySQL Error  Unknown column 'Array' in 'where clause' 
Reply With Quote
  #15  
Old 06-02-2007, 01:39 PM
succo succo is offline
Member
 
Join Date: Nov 2005
Posts: 85
Default Re: News pagination

ok, i didn't try this on a forum where the news were taken from more than one forum

i'm looking on how to transform the array $mod_options['forumid'] in a string

ok... here it is...

just at the top of my patch, add these lines:
Code:
if (is_array($mod_options['portal_news_forumid'])) {
$forumid = implode(',', $mod_options['portal_news_forumid']);
}
else {
$forumid = $mod_options['portal_news_forumid'];
}
the $count line will now be:
Code:
$count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "thread WHERE forumid in (".$forumid.")");
this should work

Last edited by succo; 06-02-2007 at 02:53 PM.
Reply With Quote
  #16  
Old 06-03-2007, 12:18 AM
convergent convergent is offline
Senior Member
 
Join Date: Jan 2006
Location: NY
Posts: 150
Default Re: News pagination

OK, that solved the multi-forum problem, but I'm still confused about where this needs to go in the code. I put it just after this...

PHP Code:
            // Rating
            
$news['rating'] = intval(round($news['voteavg'])); 
First the first block of code, followed immediately by the line to call the template.

Then I created a template of that name and dropped the code in it.

If I setup to no separate posts, it doesn't show up at all. If I do separate posts, I get this... http://pdaphonehome.com/index.php?page=testnav

The page nav is not in the right place I'm guessing. The other problem is that I can navigate with the buttons on this page, but the news displayed doesn't index up or back to the correct posts... it keeps showing the same ones.
Reply With Quote
  #17  
Old 06-03-2007, 06:34 AM
succo succo is offline
Member
 
Join Date: Nov 2005
Posts: 85
Default Re: News pagination

you mean the 'eval' line???

it was written in the original post, i guess

it goes just above
Code:
$db->free_result($getnews);
the first edit replaces this line:
Code:
$newslimit = 'LIMIT ' . ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']);
btw, you could use it with the gars cmps module too (in fact i first wrote it for that module as i'm going to remove the original news module)

i rewrote it a little just to make the options be in the cmps administration panel, but it basically stays the same... if interested i could send you the full module

bye
Reply With Quote
  #18  
Old 07-08-2007, 03:11 AM
jw0ollard jw0ollard is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
Default Re: News pagination

Great work Succo, wish I would have checked this thread a month ago.

Did you design this to work with 2.0 or 3.0? I'm having an issue with my News disappearing entirely if I don't have the News Archive enabled. The only reason I had News Archive enabled was because I didn't have working pagination, and now I can't get rid of it!

If I disable the News Archive the News disappears entirely, and if I set the News Archive # of posts to 0 the pagination no longer works correctly.

Also what I've noticed is that it doesn't show the news posts in the News Archive as full news posts when you go to the second page. So if I have it set to show 10 News Archive posts, those 10 posts are never seen as full news posts when you go to the second page, it just skips them entirely.

I've become increasingly good with PHP since I first started this thread, so I may be able to sort out my problems. But it doesn't hurt to ask for help, right?
Reply With Quote
  #19  
Old 07-14-2007, 05:11 PM
tresor tresor is offline
Member
 
Join Date: Nov 2005
Posts: 99
Default Re: News pagination

Quote:
Originally Posted by convergent View Post
Could you explain where you are putting these edits???? which files, and where? Thanks. I'll try it.
I don´t know too, can anybody explain where we have to do changes?
Thanks
Reply With Quote
  #20  
Old 07-17-2007, 11:38 AM
succo succo is offline
Member
 
Join Date: Nov 2005
Posts: 85
Default Re: News pagination

Quote:
Originally Posted by TheMilkCarton View Post
Great work Succo, wish I would have checked this thread a month ago.

Did you design this to work with 2.0 or 3.0?
it's for 3.0 but should work on 2.0 too
Quote:
I'm having an issue with my News disappearing entirely if I don't have the News Archive enabled. The only reason I had News Archive enabled was because I didn't have working pagination, and now I can't get rid of it!
strange, as i haven't got news archive enabled (i had to remove it as i wanted to use gars for the news, and i couldn't have the news archive work without the news module active, so worked around with some mods to the recent threads module)
Quote:
If I disable the News Archive the News disappears entirely, and if I set the News Archive # of posts to 0 the pagination no longer works correctly.

Also what I've noticed is that it doesn't show the news posts in the News Archive as full news posts when you go to the second page. So if I have it set to show 10 News Archive posts, those 10 posts are never seen as full news posts when you go to the second page, it just skips them entirely.

I've become increasingly good with PHP since I first started this thread, so I may be able to sort out my problems. But it doesn't hurt to ask for help, right?
again, that's strange...
look at the first block of code...
Code:
$limit = ($mod_options['portal_news_maxposts'] + $mod_options['portal_news_enablearchive']);
this sets the variable $limit to the sum of the number of posts to show for the news plus the number for the archive

after, in this block you can see
Code:
	$newslimit = 'LIMIT ' . ($start - 1) . ',' . $limit;

	if (($start + $mod_options['portal_news_maxposts']) < $count['count']){
		$previous = ($start + $mod_options['portal_news_maxposts']);
	}
	if ($start > $mod_options['portal_news_maxposts']){
		$next = ($start - $mod_options['portal_news_maxposts']);
this should tell the script what posts to select (from # $start-1 for $limit posts) and set $previous and $next to $start pls the mumber of posts for the news and $start minus the number of posts for the news, so the news archive is never evaluated, only for the 'full' number of posts to select, but only when the new page is loaded... so, say i have set the news limit to 5 and the news archive to 5 again, i should have the first 5 posts in the first news page, and in the second from 6 to 10, not from 11 to 15, that's how it should work (and how it works in my installment )

let me know
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagination for the news module? WiBu Modifications (version 3.x & 2.x) 6 06-13-2007 07:27 PM
Pagination on Most Recent Post Module rbehler "How Do I..." Questions 1 01-03-2007 03:39 PM
Pagination Help AlienSector Chit Chat 10 12-15-2005 06:56 PM
Pagination Ian Gordon Troubleshooting / "How do I..." Questions 2 06-26-2004 04:21 PM


All times are GMT -4. The time now is 12:18 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.