Leah Posted December 10, 2013 Share Posted December 10, 2013 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 https://forums.phpfreaks.com/topic/284686-php-help-for-paginationhelp/ Share on other sites More sharing options...
dalecosp Posted December 10, 2013 Share Posted December 10, 2013 For a quick hack, try changing this: $target_page_num = !empty($target_page_num) ? $target_page_num[2] : 0; to this: $target_page_num = !empty($target_page_num) ? $target_page_num[0] : 0; Not sure it's right, though --- YMMV and all that. Link to comment https://forums.phpfreaks.com/topic/284686-php-help-for-paginationhelp/#findComment-1461960 Share on other sites More sharing options...
Leah Posted December 10, 2013 Author Share Posted December 10, 2013 You're a genius!!!! Thank you, it worked. Link to comment https://forums.phpfreaks.com/topic/284686-php-help-for-paginationhelp/#findComment-1461964 Share on other sites More sharing options...
dalecosp Posted December 10, 2013 Share Posted December 10, 2013 You're a genius!!!! Thank you, it worked. LOL ... no, not *quite*. Just a programmer. Glad to hear it! Link to comment https://forums.phpfreaks.com/topic/284686-php-help-for-paginationhelp/#findComment-1462011 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.