Jump to content

PHP help for pagination...HELP!


Leah
Go to solution Solved by dalecosp,

Recommended Posts

Hi folks, 

 

you could help me with a PHP question. I changed our pagination from .../?page=0%2C0%2C1 to ?page=1.

 

The problem now is that a few custom codes aren't working anymore. There is one code that puts all following pages as nofollow/noindex. The code worked with the long pagination URL but not with the short. Here's the code:

 



<?php
$target_page= explode("/",$_SERVER['REQUEST_URI']);
$target_page= $target_page[1];

$pages_with_nofollow = array(
'nyc-apartments-by-school',
'park',
);

if(in_array($target_page, $pages_with_nofollow) ===true){
$target_page_num = isset($_GET['page']) ? explode(",",$_GET['page']) : 0;
$target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0;
if($target_page_num > 0){
$variables['head'] .= '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">';
}


}
?>


What do I need to change?

 

Thank you!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.