Announcement

Collapse
No announcement yet.

Pagenav templates for forumdisplay.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pagenav templates for forumdisplay.php

    For SEO purposes, I am trying to make the url simpler for page 1, 2, 3, next, prev on the forum display.

    I am trying to do away with $address2 for the default, where a person is not logged in, then if sort order different from default has been selected, use the $address2.

    So what are the variables for the following (for use in template):
    • person logged in or not - if they are logged in then I'll use $address2
    • variables for thread title sort, and its default
    • for postusername and its default
    • votavg (rating) and its default
    • lastpost and its default
    • views and its default
    Thanks
    Michael Brandon
    Search Engine Optimize vBulletin-url rewrites,keyword selection,Google sitemap,SEOer to SEO sites
    My SEO company - SearchMasters


  • #2
    The PHP code to determine if a user is logged in is:

    PHP Code:
    // IF USER IS LOGGED IN
    if ($bbuserinfo[userid])
    {
        
    // CODE TO EXECUTE IF USER IS LOGGED IN
    }
    else
    {
        
    // CODE IF USER IS NOT LOGGED IN

    Or if you are in the templates you can use this template conditional:

    Code:
    <if condition="$bbuserinfo[userid]">
    	// CODE TO OUTPUT IF USER IS LOGGED IN
    <else />
    	// CODE IF USER IS NOT LOGGED IN
    </if>
    The code to use within these conditions depends on exactly what you are trying to do.

    The variables for sorting the columns are in the source code of the forumdisplay page:

    Code:
    <tr>
    	
    		<td class="thead" colspan="2">&nbsp;</td>
    		
    	<td class="thead" width="100%">
    		<span style="float:right"><a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=desc&amp;sort=voteavg">Rating</a> </span>
    		<a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=asc&amp;sort=title">Thread</a>  /
    		<a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=asc&amp;sort=postusername">Thread Starter</a> 
    	</td>
    	<td class="thead" width="150" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=desc&amp;sort=lastpost">Last Post</a> <a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=asc&amp;sort=lastpost&amp;pp=40&amp;page=1"><img class="inlineimg" src="http://images.vbulletin.com/images_vb3/buttons/sortasc.gif" alt="Reverse Sort Order" border="0" /></a></span></td>
    	<td class="thead" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=desc&amp;sort=replycount">Replies</a> </span></td>
    	<td class="thead" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="forumdisplay.php?f=56&amp;daysprune=30&amp;order=desc&amp;sort=views">Views</a> </span></td>
    </tr>
    For example, to sort by the thread title you need to have &sort=title at the end of the URL.

    Comment


    • #3
      Thanks

      Thanks. It seems like not all the variables are accessable in the template, so I have hacked the php.

      per my forum entry Search Engine Optimise VBulletin 3.01

      The page navigation has sorting options which require a rather long url since the options are not stored in cookies (this would be a good idea). Since I want the url to be in the simple form of f=x&page=y, I considered it a good idea to show the simple url's when the default sort option was kept, and the user was not logged on (ie a search engine). Although the search engines will click on the search function, there will at least be one simple set of url's for it to follow that lead it to all the individual threads. This is in addition to the site map available. General idea - I want as many urls as possible to be able to be spidered by Google so as to transfer the max PR from any inbound link. Google will spider the long url's, but shorter is definately preferable.


      Code:
      in [b][color=black]forumdisplay.php[/b]
      // added by Michael Brandon - for SEO to simplify url if not logged on, and using default options
      [/color]
      Code:
      [size=2][b]if[/b]([/size][size=2][color=#800000]$sortfield[/color][/size][size=2]==[/size][size=2][color=#0000f0]'lastpost'[/color][/size][size=2] [b]and[/b] ([/size][size=2][color=#800000]$sortorder[/color][/size][size=2]==[/size][size=2][color=#0000f0]'desc'[/color][/size][size=2] [b]or[/b] [/size][size=2][color=#800000]$sortorder[/color][/size][size=2]==[/size][size=2][color=#0000f0]''[/color][/size][size=2]) [b]and[/b] ![/size][size=2][color=#800000]$bbuserinfo[/color][/size][size=2][[/size][size=2][color=#0000f0]'userid'[/color][/size][size=2]])[/size]
      [size=2]{[/size]
      [size=2][color=#800000]$pagenav[/color][/size][size=2] = construct_page_nav([/size][size=2][color=#800000]$totalthreads[/color][/size][size=2], [/size][size=2][color=#0000f0]"forumdisplay.php?[/color][/size][b][size=2]$session[/size][/b][size=2][/size][size=2][color=#0000f0][sessionurl]f=[/color][/size][b][size=2]$forumid[/size][/b][size=2][/size][size=2][color=#0000f0]"[/color][/size][size=2]);[/size]
      [size=2]}[/size]
      [size=2][b]else[/b][/size]
      [size=2]{//previous coding[/size]
      [size=2][color=#800000]$pagenav[/color][/size][size=2] = construct_page_nav([/size][size=2][color=#800000]$totalthreads[/color][/size][size=2], [/size][size=2][color=#0000f0]"forumdisplay.php?[/color][/size][b][size=2]$session[/size][/b][size=2][/size][size=2][color=#0000f0][sessionurl]f=[/color][/size][b][size=2]$forumid[/size][/b][size=2][/size][size=2][color=#0000f0]"[/color][/size][size=2], [/size][size=2][color=#0000f0]"&amp;sort=[/color][/size][b][size=2]$sortfield[/size][/b][size=2][/size][size=2][color=#0000f0]&amp;order=[/color][/size][b][size=2]$sortorder[/size][/b][size=2][/size][size=2][color=#0000f0]&amp;pp=[/color][/size][b][size=2]$perpage[/size][/b][size=2][/size][size=2][color=#0000f0]&amp;daysprune=[/color][/size][b][size=2]$daysprune[/size][/b][size=2][/size][size=2][color=#0000f0]"[/color][/size][size=2]);
      }
      [/size][size=3][/size]
      Michael Brandon
      Search Engine Optimize vBulletin-url rewrites,keyword selection,Google sitemap,SEOer to SEO sites
      My SEO company - SearchMasters

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X