View Full Version : Page Numbers with Mod_Rewrite
Ian Cunningham
01-06-2004, 07:55 AM
I have created a mod_rewrite hack for my site, and I can get the main thread to appear in the form thread-xxx.php (where xxx is the threadid). Example : http://www.pcreview.co.uk/thread-3930.php
I have a problem in the temlates when I want to call each new page thread-xxx-y.php (where y is the page number). I have coded this fine in Mod_Rewrite, but I can't find out how to mod this in the VB templates.
In the pagenav_pagelink template, there is the following code:
[b]<a href="$address&pagenumber=$curpage">$curpage</a>[b]
I want this changed to this format:
[b]<a href="thread-$thread[threadid]-$curpage">$curpage</a>[b]
I have tried using this code, but $thread[threadid] is not recognised. Can anyone tell me how to allow this to be called, or any other ideas? Once I have the mod_rewrite hack complete, I'll release it onto the forums. :)
Dean C
01-06-2004, 10:04 AM
I had this exact same problem. In the end I decided just to leave the spider to index the first page only.
Ian Cunningham
01-06-2004, 03:32 PM
Oh poo - I'll keep working on it, and I'll let you know here if I can get it working. If anyone has any ideas that would be great :)
NTLDR
01-06-2004, 05:58 PM
The page nav templates are used in places other than threads which is why the variable isn't avalible. I'd take a look at functions.php (in particular the constuct_page_nav() function, and the information that is passed to the function in showthread.php for example.
Ian Cunningham
01-07-2004, 04:49 PM
OK, I will take a look at that, but I am php novice, so I hope it is easy to understand :) Should it be simple to do?
Ian Cunningham
01-07-2004, 05:51 PM
I've given it a go, but I cant find constuct_page_nav anywhere in the functions.php file (2.2.8)
Dean C
01-07-2004, 06:11 PM
That's because Lee assumed you were using vB3 :) Look for getpagenav :)
Ian Cunningham
01-07-2004, 06:14 PM
Cheers Dean! I found that section and tried adding $threadid into the "function getpagenav($results,$address) {" part, but I got an error. Would you be able to point me in the right direction?
NTLDR
01-07-2004, 06:22 PM
You'd want to change it to somthing similar to:
function getpagenav($results,$address, $threadid = 0) {
and then in showthread.php modify the call to the function to pass the threadid across. Note the = 0 on the end which means it won't generate errors if you don't send a threadid for example on the members list.
Ian Cunningham
01-07-2004, 07:00 PM
I do appologise for keeping asking you questions, I just can't get my head round this :) I have modified the line in functions.php which you told me, but I don't understand the showthread part.
Would I add something to this line in showthread.php?
"$pagenav = getpagenav($totalposts,"showthread.php?threadid=$threadid&perpage=$perpage".iif(isset($highlight), "&highlight=$highlight", ""));"
Ian Cunningham
01-07-2004, 07:29 PM
I did it :) Thanks for your help guys :)
"$threadid= $thread[threadid];
$pagenav = getpagenav($totalposts,"showthread.php?threadid=$threadid&perpage=$perpage".iif(isset($highlight), "&highlight=$highlight", ""),$threadid);"
Dean C
01-08-2004, 12:02 PM
Your welcome :) Btw you have a horizontal scrollbar at 800 X 600 res on your site :(
Ian Cunningham
01-13-2004, 03:18 PM
Cheers Mist - I'll have to re-organise the width a little :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.