Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Paginator  (Read 6599 times)

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Paginator
« on: September 18, 2008, 05:19:03 AM »

I think is a bug (a SEO one?):

When you submit a link with a page number bigger than your maximum number of pages, you always get your last page instead of 404.

I think we should check $pageNum against $maxPage and return 404 in function paginator if $pageNum is bigger ....

Example:
Let's suppose we have a maximum pages of 12 in ... does not matter.
And we type www.yourdomain.com/home/p_20/ . This link will send me to  www.yourdomain.com/home/p_12/ instead of 404 error.
Logged

Joost

  • Guest
Re: Paginator
« Reply #1 on: September 18, 2008, 06:15:23 PM »

This "issue" is known. It is not easy to fix, I am afraid. But the issue (from SEO perspective) will only occur, when a link is made to a non existent uri (p_ max +).
Logged

Armen

  • Sr. Member
  • ****
  • Karma: 41
  • Posts: 338
    • http://www.funnydays.ru
Re: Paginator
« Reply #2 on: September 19, 2008, 04:28:11 PM »

This "issue" is known. It is not easy to fix, I am afraid. But the issue (from SEO perspective) will only occur, when a link is made to a non existent uri (p_ max +).


No, it can be done:you can send user to 404.

To do so, find function center().

Find these lines:

Code: [Select]
$articleCount = s('article_limit');
$article_limit = (empty($articleCount) || $articleCount < 1) ? 100 : $articleCount;
$totalPages = ceil($numrows_articles/$article_limit);
if (!isset($currentPage) || !is_numeric($currentPage) || $currentPage < 1) {$currentPage = 1;}

Right after them add:

Code: [Select]
// If more pages requested than present, send to 404, to evade content duplication
else if ($currentPage > $totalPages) {header('Location: '.db('website').'404/'); exit;}
Logged
Now ogres, oh, they're much worse. They'll make a suit from your freshly peeled skin. They'll shave your liver, squeeze the jelly from your eyes... Actually, it's quite good on toast.

Joost

  • Guest
Re: Paginator
« Reply #3 on: September 19, 2008, 05:14:43 PM »


No, it can be done:you can send user to 404.

To do so, find function center().


Have you tried this? I expect the 200 header is already send, when function center kicks in. To late to send 404 then.

This invokes a 302 redirect as well. Basically saying: All max + pages are located at /404/ (which cannot be found).
« Last Edit: September 19, 2008, 05:23:06 PM by Joost »
Logged

Armen

  • Sr. Member
  • ****
  • Karma: 41
  • Posts: 338
    • http://www.funnydays.ru
Re: Paginator
« Reply #4 on: September 19, 2008, 05:32:47 PM »

Yes, but with my modded sNews... There's not much left from original sNews there, so there can be slight incompability with vanilla sNews version.

But you get the idea, Joost.
Logged
Now ogres, oh, they're much worse. They'll make a suit from your freshly peeled skin. They'll shave your liver, squeeze the jelly from your eyes... Actually, it's quite good on toast.

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Paginator
« Reply #5 on: September 19, 2008, 05:35:41 PM »

Correct me if I'm wrong...

The first processing of a request is in startup function? Then why are not analized (the requests) in detail, essentials stored in global variables and let center do the rest if are a valid request?

If not valid, resolved from the beginning....
Logged

Armen

  • Sr. Member
  • ****
  • Karma: 41
  • Posts: 338
    • http://www.funnydays.ru
Re: Paginator
« Reply #6 on: September 19, 2008, 05:43:26 PM »

Because global variables are bad.

No, startup function has nothing to do with paginator's max number (1.6 version). If you want, you can perform a check for max number of pages at the beginning of the startup function and later check paginator calls against it.
Logged
Now ogres, oh, they're much worse. They'll make a suit from your freshly peeled skin. They'll shave your liver, squeeze the jelly from your eyes... Actually, it's quite good on toast.

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Paginator
« Reply #7 on: September 19, 2008, 05:47:27 PM »

Globals are bad only if you, as programmer, don't use them correctly. With care, this is a good practice. At least, for Wordpress and others (I think also 1.7 ....)

But yes, I think a validation and a decision must be made at the beginning. But this mean a newly restructured sNews.

Edit:
----------------------------------
I know startup have nothing to do with pagination... I mean, every request must be validated from the beginning ... as an aerial traffic controller ...
« Last Edit: September 19, 2008, 05:51:42 PM by funlw65 »
Logged

Joost

  • Guest
Re: Paginator
« Reply #8 on: September 19, 2008, 06:21:08 PM »

Globals are bad only if you, as programmer, don't use them correctly. With care, this is a good practice. At least, for Wordpress and others (I think also 1.7 ....)

I fully agree, Vasi.  :)


But yes, I think a validation and a decision must be made at the beginning. But this mean a newly restructured sNews.

Edit:
----------------------------------
I know startup have nothing to do with pagination... I mean, every request must be validated from the beginning ... as an aerial traffic controller ...

Lets look at the 'issue'.
The (seo) issue will only occur, when inbound links are created to a non-existent  (p_)page.
- How often will this happen?
- Should we leave it like this, as a calculated risk?
- Or should it be fulladdressed and turn the sytem upside down? 
- Or should we use redirects to a not found page?


Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Paginator
« Reply #9 on: September 19, 2008, 06:27:14 PM »

I agree with the SEO issue, it can appear only if you have 'friends'. And we are on Internet and 'friends' are everywhere . Why give them a hook?

But is not only about pagination, is about entire sNews... I'm sure this can be good for a good CMS...


But yes, I think a validation and a decision must be made at the beginning. But this mean a newly restructured sNews.

... I mean, every request must be validated from the beginning ... and distributed ... as an aerial traffic controller ...
Logged

Joost

  • Guest
Re: Paginator
« Reply #10 on: September 19, 2008, 06:55:02 PM »

Personally, I would like to get rid of pagination. The relation between location and pagination is dreadfully loose, hard to calculate and causing this kind of issues. The relationship is similar to the way comments are handled (not a fan of that either).
So how I see a future, is kicking the weak functionality out and look for something better.
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Paginator
« Reply #11 on: September 19, 2008, 07:11:41 PM »

So how I see a future, is kicking the weak functionality out and look for something better.

That's the spirit!  ;D
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU