Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2013, 09:40 PM
dethfire dethfire is offline
 
Join Date: Feb 2003
Posts: 441
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Adding <link rel="prev" etc

Has anyone been successful in adding <link rel="prev and "next" tags in their threads? I see most current software is doing this regardless of physical pagination.
Reply With Quote
  #2  
Old 01-06-2015, 09:06 PM
Ameise Ameise is offline
 
Join Date: Mar 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I try it with the
Code:
<if condition="$show['next']"><link rel="next" href="$address$address2&amp;page=$nextpage</if>
<if condition="$show['prev']"><link rel="prev" href="$address$address2<if condition="$prevpage != 1">&amp;page=$prevpage</if></if>
but the hook is not active in the headinclude
Reply With Quote
Благодарность от:
ozzy47
  #3  
Old 01-06-2015, 09:36 PM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for posting the suggestion, even though the question was asked thirteen months ago.
Reply With Quote
  #4  
Old 01-07-2015, 08:42 AM
Ameise Ameise is offline
 
Join Date: Mar 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But is not solved.
I try something in the function.php by line 2405 to add the headinclude, but it doesnt work.
Reply With Quote
  #5  
Old 01-07-2015, 09:55 AM
ozzy47's Avatar
ozzy47 ozzy47 is offline
 
Join Date: Jul 2009
Location: USA
Posts: 10,929
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just to be clear, you are trying too add something like in the attached screenshot?
Attached Images
File Type: jpg prev next.jpg (100.2 KB, 0 views)
Reply With Quote
  #6  
Old 01-07-2015, 02:13 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ameise View Post
I try it with the
Code:
<if condition="$show['next']"><link rel="next" href="$address$address2&amp;page=$nextpage</if>
<if condition="$show['prev']"><link rel="prev" href="$address$address2<if condition="$prevpage != 1">&amp;page=$prevpage</if></if>
but the hook is not active in the headinclude
Yeah, the problem is that the headinclude template is rendered before any of the page values are calculated. What you might be able to do is a str_replace on the $header variable at some later time. I'd have to know your exact version (and have that source available) to know what's around line 2405 of function.php. But maybe you can use a plugin at hook locaton pagenav_complete to add them, with code something like:
PHP Code:
global $headinclude;
if (
$show['next'])
{
   
$headinclude .= "<link rel=\"next\" href=\"{$address}{$address2}&amp;page={$nextpage}\"/>\n";
}
if (
$show['prev'])
{
   
$headinclude .= "<link rel=\"prev\" href=\"{$address}{$address2}&amp;page={$prevpage}\"/>\n";


Edit: (I replaced the above code - I copied the wrong version).
Reply With Quote
  #7  
Old 01-15-2015, 09:32 AM
Ameise Ameise is offline
 
Join Date: Mar 2008
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works fine with this code:
Code:
 if ($pagenumber > 1)
        {
        global $headinclude;
                $prevpage = $pagenumber - 1;
                $prevnumbers = fetch_start_end_total_array($prevpage, $perpage, $results);
                $show['prev'] = true;
                $headinclude .= "<link rel=\"prev\" href=\"{$address}&amp;page={$prevpage}\">\n";
        }
        if ($pagenumber < $totalpages)
        {
        global $headinclude;
                $nextpage = $pagenumber + 1;
                $nextnumbers = fetch_start_end_total_array($nextpage, $perpage, $results);
                $show['next'] = true;
                $headinclude .= "<link rel=\"next\" href=\"{$address}&amp;page={$nextpage}\">\n";
        }
Reply With Quote
4 благодарности(ей) от:
hilaryl, kh99, SnakeV, webexit
  #8  
Old 01-19-2015, 01:17 AM
hilaryl hilaryl is offline
 
Join Date: Jan 2006
Location: Brisbane, Australia
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How would you do this without making changes to functions.php?

Is there a way to get the variables you need by using a plugin?

Been stumped on this one for a while.

Cheers,
hilaryl
Reply With Quote
  #9  
Old 03-12-2015, 11:32 AM
kodbg kodbg is offline
 
Join Date: Jul 2002
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, is there a solution for adding prev / next in head?

PP - Sorry, the code above works fine - thank you
Reply With Quote
  #10  
Old 04-01-2015, 09:59 PM
hilaryl hilaryl is offline
 
Join Date: Jan 2006
Location: Brisbane, Australia
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Ameise View Post
Works fine with this code:
Code:
 if ($pagenumber > 1)
        {
        global $headinclude;
                $prevpage = $pagenumber - 1;
                $prevnumbers = fetch_start_end_total_array($prevpage, $perpage, $results);
                $show['prev'] = true;
                $headinclude .= "<link rel=\"prev\" href=\"{$address}&amp;page={$prevpage}\">\n";
        }
        if ($pagenumber < $totalpages)
        {
        global $headinclude;
                $nextpage = $pagenumber + 1;
                $nextnumbers = fetch_start_end_total_array($nextpage, $perpage, $results);
                $show['next'] = true;
                $headinclude .= "<link rel=\"next\" href=\"{$address}&amp;page={$nextpage}\">\n";
        }
Have added this as a plugin - and pushing the links to page so that's bloody awesome.

Have been looking for a solution to this issue for a while now - and this is perfect. Had to tweak a few things to allow for my URL structure - but it's working perfectly now.

Also added in an if statement to cater for being on page 2 and not including a 'page=1' to the previous page.

THANK YOU VERY MUCH!!
Reply With Quote
2 благодарности(ей) от:
kh99, SnakeV
Reply


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


All times are GMT. The time now is 05:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10624 seconds
  • Memory Usage 2,296KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (7)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete