Raftysworld
07-25-2005, 08:55 PM
Okay, so I have a forum located at http://www.example.com/forums. The vBaCMPS root is http://www.example.com/index.php. Everything works great. So I found a MOD by Zero Tolerance that displays a preview of a new PM on the forumhome. I wanted to modify this, so i moved the file changes from index.php to global.php, and modified the header template instead. It all works perfect, displays on every page including the CMPS homepage. The problem is, despite the header/navbar replacement variables, the "Read this PM" still links to example.com/private.php without appending "forums" to the URL. So I was wondering how i could fix this? Here are the relevant bits of code:
In Global.php:
// templates to be included in every single page...
$globaltemplates = array_merge($globaltemplates, array(
/*snip*/
'pm_show',
/*snip*/
));
Also,
// #############################################################################
// get global pm preview
if($bbuserinfo['pmunread'] > 0){
require_once('./includes/functions_user.php');
// Get The PM Information
$from = $DB_site->query_first("
SELECT pm.*, pmtext.*, fuser.*
FROM " . TABLE_PREFIX . "pm AS pm
LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
LEFT JOIN " . TABLE_PREFIX . "user AS fuser on (fuser.userid = pmtext.fromuserid)
WHERE pm.userid=$bbuserinfo[userid] AND pm.messageread = 0
ORDER BY pmtext.dateline DESC
LIMIT 0, 1
");
$from['av_disp'] = fetch_avatar_url($from['userid']);
if($from['av_disp'] == ""){
$from['av_disp'] = "<b>No Avatar</b>";
} else {
$from['av_disp'] = "<img src='{$from['av_disp']}' alt='{$from['username']}\'s Avatar' border='0' />";
}
// Cut Message To 400 Characters
if(strlen($from['message']) > 400){
$from['message'] = substr($from['message'],0,400) . "...";
}
// Parse The Message
require_once('./includes/functions_bbcodeparse.php');
$from['message'] = parse_bbcode2($from['message'], $vboptions['privallowhtml'], $vboptions['privallowbbimagecode'], iif($vboptions['privallowsmilies'] AND $from['allowsmilie'], 1, 0), $vboptions['privallowbbcode']);
eval("\$PMShow = \"".fetch_template('pm_show')."\";");
} else {
$PMShow = "";
}
In Global.php:
// templates to be included in every single page...
$globaltemplates = array_merge($globaltemplates, array(
/*snip*/
'pm_show',
/*snip*/
));
Also,
// #############################################################################
// get global pm preview
if($bbuserinfo['pmunread'] > 0){
require_once('./includes/functions_user.php');
// Get The PM Information
$from = $DB_site->query_first("
SELECT pm.*, pmtext.*, fuser.*
FROM " . TABLE_PREFIX . "pm AS pm
LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
LEFT JOIN " . TABLE_PREFIX . "user AS fuser on (fuser.userid = pmtext.fromuserid)
WHERE pm.userid=$bbuserinfo[userid] AND pm.messageread = 0
ORDER BY pmtext.dateline DESC
LIMIT 0, 1
");
$from['av_disp'] = fetch_avatar_url($from['userid']);
if($from['av_disp'] == ""){
$from['av_disp'] = "<b>No Avatar</b>";
} else {
$from['av_disp'] = "<img src='{$from['av_disp']}' alt='{$from['username']}\'s Avatar' border='0' />";
}
// Cut Message To 400 Characters
if(strlen($from['message']) > 400){
$from['message'] = substr($from['message'],0,400) . "...";
}
// Parse The Message
require_once('./includes/functions_bbcodeparse.php');
$from['message'] = parse_bbcode2($from['message'], $vboptions['privallowhtml'], $vboptions['privallowbbimagecode'], iif($vboptions['privallowsmilies'] AND $from['allowsmilie'], 1, 0), $vboptions['privallowbbcode']);
eval("\$PMShow = \"".fetch_template('pm_show')."\";");
} else {
$PMShow = "";
}