Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

rel=next rel=prev


DAVID3733

Recommended Posts

Hi there

 

I am using OSC 2.3.4BS

 

I wish to use pagination Rel=next & rel=prev for multi page categories, products_new, all_products etc

 

By editing includes/classes/spilt_page_results.php with some code I found in the forums I belive i have the correct next and prev showing in categories page, but this does not show in the head of the document so is usless for the search engines,

 

How would i echo the information into the head of the page so the search engines can view it along with the canonical?

 

below is how i have edited the spilt_page_results.php

// display split-page-number-links
    function display_links($max_page_links, $parameters = '') {
      global $PHP_SELF, $request_type;

      $display_links_string = '';

      $class = 'class="pageResults"';

      if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';

// previous button - not displayed on first page
//        if ($this->current_page_number > 1) {$display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' ">«</a></li>';
          if ($this->current_page_number > 1) {$display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" rel="prev" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' ">«</a></li>';
      } else {
        $display_links_string .= '<li class="disabled"><span>«</span></li>';
      }
// check if number_of_pages > $max_page_links
      $cur_window_num = intval($this->current_page_number / $max_page_links);
      if ($this->current_page_number % $max_page_links) $cur_window_num++;

      $max_window_num = intval($this->number_of_pages / $max_page_links);
      if ($this->number_of_pages % $max_page_links) $max_window_num++;

// previous window of pages
      if ($cur_window_num > 1) $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a></li>';

// page nn button
      for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
        if ($jump_to_page == $this->current_page_number) {
          $display_links_string .= '<li class="active"><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '<span class="sr-only">(current)</span></a></li>';
        } else {
         
//	         $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '</a></li>';
             $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" title=" ' . ($jump_to_page == $this->current_page_number-1 ? ' rel="prev"' : ($jump_to_page == $this->current_page_number+1 ? ' rel="next"' : '')) . ' title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' ">' . $jump_to_page . '</a></li>';

	        }
      }

// next window of pages
      if ($cur_window_num < $max_window_num) $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a></li>';

// next button
//      if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) { $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' ">»</a></li>';
      if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) { $display_links_string .= '<li><a href="' . tep_href_link($PHP_SELF, $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" rel="next" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' ">»</a></li>';
        } else {
        $display_links_string .= '<li class="disabled"><span>»</span></li>';
      }

      return $display_links_string;
    }

Thank you

 

David

 

David

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...