•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,563 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,508 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 71631 | Replies: 238
![]() |
•
•
Join Date: Oct 2004
Location: Dublin, Ireland
Posts: 32
Reputation:
Rep Power: 5
Solved Threads: 0
Hi,
For those of you having problems displaying sub-forums on your homepage here is the fix.
Open includes/functions_forumlist.php
Look for the line that reads (around line 527):
[php]$forum = $forumcache["$forumid"];[/php]And below that add
[php]// added by keith
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by keith[/php]That should do it
If you have any problems let me know and I'll see what I can do.
For those of you having problems displaying sub-forums on your homepage here is the fix.
Open includes/functions_forumlist.php
Look for the line that reads (around line 527):
[php]$forum = $forumcache["$forumid"];[/php]And below that add
[php]// added by keith
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by keith[/php]That should do it

If you have any problems let me know and I'll see what I can do.
•
•
Join Date: Sep 2004
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I used Cyber-SEO's little hack for the nav bar but have found a problem...
For some reason on page http://www.cardschat.com/t19-%5Bblog...-showdown.html
it only links to main-category.html not f1-main-category.html typa thing, any ideas?
For some reason on page http://www.cardschat.com/t19-%5Bblog...-showdown.html
it only links to main-category.html not f1-main-category.html typa thing, any ideas?
•
•
Join Date: Oct 2004
Location: Dublin, Ireland
Posts: 32
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
•
•
Originally Posted by Natch
Now, search for every instance of [php]$userinfo['where'][/php]which refers to the three $filename instances above and alter the <a href="... statement to match the rewritten display of your URLs...
examples
[php]$userinfo['where'] = "<a href=\"f$forumid-" . mod_rewrite_title($forumtitle) . ".html\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"post$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";[/php]
Where it reads:
[php]$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]it should in fact read
[php]$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]
Last edited by cscgal : Oct 17th, 2004 at 11:23 pm.
•
•
Join Date: Oct 2004
Location: Townsville, Australia
Posts: 16
Reputation:
Rep Power: 5
Solved Threads: 0
•
•
•
•
Originally Posted by KeithMcL
There is a slight error in the code above.
Where it reads:
[php]$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]it should in fact read
[php]$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]
Natcher00 ... is the Admin @ MobileForces.org - Official Community for a cult Vehicle based FPS - the only place for support!
[vB.org] PNG24 transparency with IE * DaniWeb: mod_rewrite your vB
[vB.org] PNG24 transparency with IE * DaniWeb: mod_rewrite your vB
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,020
Reputation:
Rep Power: 33
Solved Threads: 117
Ok, Edited
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,020
Reputation:
Rep Power: 33
Solved Threads: 117
Just to let everyone know, Keith was generous enough to have rewritten this tutorial combining my hack as well as Ted's.
http://www.daniweb.com/tutorials/12725.html
http://www.daniweb.com/tutorials/12725.html
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Oct 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I noticed that when you go to click on the latest post, the target url is "newpostinthread3.html" but when you click it, it links you to "showthread.php?p=3#post3" so did I do something wrong? Yet when you are viewing the forum and click on that thread, it shows "thread3.html"
And also, I want to fix the Online Location problem, but Natch's solution was too hard for me to figure out, so is there an easier way? Or one that goes into more detail so I can figure it out?
And also, I want to fix the Online Location problem, but Natch's solution was too hard for me to figure out, so is there an easier way? Or one that goes into more detail so I can figure it out?
Wow. Tremendous hack.
I have a dumb question though: I don't suppose you also have a handy-dandy redirect that will point my .html pages back to the .php ones, in the event that I'm not able to keep this hack up to date...? When I was using invisionboard a while back I'd used a hack similar to this one and it worked fine, but over time I wasn't able to keep all of the necessary edits going and soon abandoned. Unfortunately, I had spiders looking for .html pages for quite some time...
I have a dumb question though: I don't suppose you also have a handy-dandy redirect that will point my .html pages back to the .php ones, in the event that I'm not able to keep this hack up to date...? When I was using invisionboard a while back I'd used a hack similar to this one and it worked fine, but over time I wasn't able to keep all of the necessary edits going and soon abandoned. Unfortunately, I had spiders looking for .html pages for quite some time...
•
•
Join Date: Oct 2004
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
hi. just for a test i put the following into the .htaccess file in the root dir of my forum:
but that made no difference whatsoever. no links changed anywhere. my hoster says that there is a workin mod_rewrite on the servers, but how come nothing works?
ps: my forum is on a subdomain.
RewriteEngine on Options +FollowSymLinks RewriteRule ^thread([0-9]+).html$ showthread.php?t=$1 [L] RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L] RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?goto=newpost&t=$1 [L] RewriteRule ^forum([0-9]+).html$ forumdisplay.php?f=$1 [L] RewriteRule ^f([0-9]+)-(.*).html$ forumdisplay.php?forumid=$1 [L] RewriteRule ^post([0-9]+).html$ showthread.php?p=$1 [L]
ps: my forum is on a subdomain.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- [Revised] vBulletin Mod_rewrite Tutorial (PHP)
- vBulletin mod_rewrite for vB 3.0.7 (Existing Scripts)
- vBulletin mod_rewrite for vB 3.0.7 (Growing an Online Community)
- vBulletin mod_rewrite in phpBB mod format (Existing Scripts)
Other Threads in the PHP Forum
- Previous Thread: Help Needed
- Next Thread: mysql_num_rows warning



Linear Mode