View Single Post
  #1  
Old 12-01-2002, 08:50 PM
LanciaStratos's Avatar
LanciaStratos LanciaStratos is offline
 
Join Date: Oct 2001
Location: somewhere you're not
Posts: 221
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I get the threadid?

I'm trying to change the URL's for forums and threads in an effort to make them more friendly to search engines like Google. I know there are several hacks with a rather different way of doing this, but I'm giving this method a shot. Right now I'm working on displaying threads by changing the normal URL (http://www.domain.com/forum/showthread.php?s=&threadid=123) to the new one (http://www.domain.com/forum/thread/123). I've almost got it working - here's what I've done so far:

- - - - - - - - - -

1. Created a copy of showthread.php and named the new file simply "thread" without any extension.

2. I then uploaded a .htaccess file in my forum directory containing the following (which will cause Apache to read the new "thread" file as a PHP script).
Code:
<Files thread> 
ForceType application/x-httpd-php 
</Files>
3. And, finally, in this new "thread" file, I've added these two lines (which I found from a post on the vB.com forums, they are highlighted in orange) at the very beginning of the file.
Code:
<?php

error_reporting(7);

$url_array=explode("/",$PATH_INFO); 
$threadid=$url_array;
$action = $HTTP_GET_VARS['action'];
$goto = $HTTP_GET_VARS['goto'];

if ( isset($goto) and ($goto=='lastpost' or $goto=='newpost')) {
  $noheader=1;
}
- - - - - - - - - -

After I perform the modifications above, I am able view a thread by using the new URL (http://www.domain.com/forum/thread/123). However, it will *only* show me the first thread on the forum (with a threadid of 1). I know the problem lies in the $threadid=$url_array; line, but I don't know what to change it to to fix it so that it will display whatever threadid number I specify in the URL. How should I change that line to achieve the desired effect?
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01071 seconds
  • Memory Usage 1,768KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete