Hi all,
I found in a great way to have url rewrites on non vb pages. It works great for me but I have a problem with forum name in url:
Custome php page: last-posts.php (the custom page retrieves last posts with seo freindly urls outside of vb)
but when I embed that php file into my main page then I have a problem in the urls: The forum name is not shown properly, it comes just an /a/ instead. eg.www.myhome.com/last-posts.php (this works fine)
However ir redirects perfect to the post, but I would like to find WHY the forum name is not retreived in the URL if I embed the php file.I get this in the url from my homepage: www.myhome.com/forum/a/post-name.html
Here I post the code of this modification, please any help would be appreciated.
]PHP Code:<?php
##########################################################################
// RECENT TOPICS (vbSEO edition) by LBmtb
// webmaster@socaltrailriders.org OR aim: LBmtb
//
// Do not remove copyright unless you donate $5 via paypal
// to the above email address, thanks
// CUSTOMIZED from a www.phase1media.com script found here:
// http://www.vbulletin.org/forum/showpost.php?p=589067&postcount=7
##########################################################################
## CUSTOMIZE THE FOLLOWING ##############################################
// DATABASE & URL SETTINGS
$db_host = "11.149.111.85"; // Change this if your MySQL database host is different.
$db_name = "S88800_5"; // Change this to the name of your database.
$db_user = "Sql888800"; // Change this to your database username.
$db_pw = "mypass"; // Change this to your database password.
$db_prefix = ""; // Change to your tables' prefix. Usually vb_
$forum_url = "http://www.mysite.com/foros"; // Change this to reflect to your forum's URL.
// APPEARANCE OPTIONS
$separator = "@"; // this goes between last poster and date
$limit = "25"; // Number of posts displayed
$post_date_format = "1"; // leave as 1 for "12/18/06 05:26 PM" or change to 2 for "05:26 PM"
// FORUM SOURCES FOR TOPICS
// use one or the other, not both. if left blank the script will return threads from any forum
$fidi_raw = ""; // ONLY include threads from these forums. seperate each ID with a comma
$fidx_raw = ""; // Exclude threads from these forum. seperate each ID with a comma
// CSS CLASSES
$recent_topics = "vb_topics"; // you can use CSS to adjust the presentation of the list
$recent_poster = "vb_last_post"; // you can use CSS to adjust the presentation the last poster and date
## VBSEO SETTINGS #####################################################
include_once "../foros/includes/functions_vbseo.php"; // change this path to reflect where your forum is
vbseo_startup(); // if you have a vbSEO version under 3, comment this line and uncomment the next three
// vbseo_get_options();
// vbseo_prepare_seo_replace();
// get_forum_info();
## NO NEED TO TOUCH ANYTHING BELOW #####################################
#############################################################################
if (!($recent_topics_connection = mysql_connect("$db_host", "$db_user", "$db_pw")))
die ("could not connect");
if (!(mysql_select_db("$db_name", $recent_topics_connection)))
mysql_error();
echo "<ul class=\"$recent_topics\">\n";
$fidi_array = explode (',', $fidi_raw);
$fidx_array = explode (',', $fidx_raw);
function forum_where($f_array,$which){
if ($which == "i") { $f_final .= "AND ("; }
if ($which == "x") { $f_final .= "AND NOT ("; }
foreach( $f_array as $key => $value){
if ($key == 0) { $f_final .= "forumid=".$value; }
else { $f_final .= " OR forumid=".$value; }
}
$f_final .= ")";
return $f_final;
}
if ($fidi_raw) { $fidi_final = forum_where($fidi_array,"i"); }
if ($fidx_raw) { $fidx_final = forum_where($fidx_array,"x"); }
$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter,forumid, rand() as random FROM ".$db_prefix."thread WHERE visible=1 AND open=1 $fidi_final $fidx_final ORDER BY random desc LIMIT $limit");
while($thread_get=@mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
if ($post_date_format == "1") { $date2 = date ("m/d/y h:i A" ,$lastpost); }
elseif ($post_date_format == "2") { $date2 = date ("h:i A" ,$lastpost); }
else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
$threadurl = vbseo_thread_url_row($thread_get, $pagenum);
echo "<li><a href=\"$forum_url/$threadurl\">$thread_get[title]</a></li>\n";
}
echo "</ul>\n<div style=\"font-size: .9em;\">recent topics by <a href=\"http://www.socaltrailriders.org/\"><acronym title=\"Southern California Trail Riders\">SocalTrailRiders.org</acronym></a></div>";
mysql_close($recent_topics_connection);
?>



LinkBack URL
About LinkBacks





Reply With Quote
