1
This hack by GI Joe shows the Xoops_redirect page messages in block in your theme instead of system_redirect.html. It also helps to speed up server execution time.
Quote:
Theme.html
Insert this 8 lines into the top of your theme.html
<{php}>
if( ! empty( $_SESSION['redirect_message'] ) ) {
if( empty( $this->_tpl_vars['xoops_lblocks'] ) ) $this->_tpl_vars['xoops_lblocks'] = array() ;
array_unshift( $this->_tpl_vars['xoops_lblocks'] , array( 'title' => 'Message' , 'content' => $_SESSION['redirect_message'] , 'weight' => 0 ) ) ;
$this->_tpl_vars['xoops_showlblock'] = 1 ;
unset( $_SESSION['redirect_message'] ) ;
}
<{/php}>
If you use XOOPS 2.2.x, also insert them into themeadmin.html
------------------------------------------------
If using XOOPS 2.0.13a-JP.
Edit line 423 in include/functions.php
$xoopsTpl->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xoopsTpl->assign('message', $message);
$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
$GLOBALS['xoopsModuleUpdate'] = 1;
// start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// end
$xoopsTpl->display('db:system_redirect.html');
exit();
} else {
$url = preg_replace("/& amp;/i", '&', htmlspecialchars($url, ENT_QUOTES));
// start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// end
echo '
<html>
<head>
line 128 in include/cp_functions.php
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td width='2%' valign='top' class='bg5' background='".XOOPS_URL."/modules/system/images/bg_menu.gif' align='center'></td>
<td width='15%' valign='top' class='bg5' align='center'><img src='".XOOPS_URL."/modules/system/images/menu.gif' /><br />
<table border='0' cellpadding='4' cellspacing='0' width='100%'>";
// start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "<tr><td>".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."</td></tr>\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// end
foreach ( $admin_mids as $adm ) {
if ( !empty($xoops_admin_menu_ft[$adm]) ) {
echo "<tr><td align='center'>".$xoops_admin_menu_ft[$adm]."</td></tr>";
}
}
--------------------------------------------------
If using XOOPS 2.0.x
line 404 in include/functions.php
$xoopsTpl->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xoopsTpl->assign('message', $message);
$xoopsTpl->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
// start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// end
$xoopsTpl->display('db:system_redirect.html');
exit();
}
line 141 in include/cp_functions.php
<table border='0' cellpadding='0' cellspacing='0' width='100%'>
<tr>
<td width='2%' valign='top' class='bg5' background='".XOOPS_URL."/m
odules/system/images/bg_menu.gif' align='center'></td>
<td width='15%' valign='top' class='bg5' align='center'><img src='".
XOOPS_URL."/modules/system/images/menu.gif' /><br />
<table border='0' cellpadding='4' cellspacing='0' width='100%'>";
// start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "<tr><td>".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."</td></tr>\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// end
foreach ( array_keys($xoops_admin_menu_ft) as $adm ) {
if ( in_array($adm, $admin_mids) ) {
echo "<tr><td align='center'>".$xoops_admin_menu_ft[$adm]."</td>
</tr>";
}
}
-------------------------------------------------
If using XOOPS 2.2.3 final
line 424 in include/functions.php
$xTheme->tplEngine->assign('url', $url);
$message = trim($message) != '' ? $message : _TAKINGBACK;
$xTheme->tplEngine->assign('message', $message);
$xTheme->tplEngine->assign('lang_ifnotreload', sprintf(_IFNOTRELOAD, $url));
$xTheme->tplEngine->assign('xoops_module_header', '<meta http-equiv="Refresh" content="2; url='.$url.'" />');
$xoopsOption['template_main'] = 'system_redirect.html';
// start
if( ! headers_sent() ) {
$_SESSION['redirect_message'] = $message ;
header( "Location: ".strtr(preg_replace('/[&]amp;/i','&',$url),"\r\n\0"," ") ) ;
exit ;
}
// end
include XOOPS_ROOT_PATH."/footer.php";
exit();
}
I wanted the message to display in the center so I used
Quote:
<{php}>
if( ! empty( $_SESSION['redirect_message'] ) ) {
if( empty( $this->_tpl_vars['xoops_ccblocks'] ) ) $this->_tpl_vars['xoops_ccblocks'] = array() ;
array_unshift( $this->_tpl_vars['xoops_ccblocks'] , array( 'title' => 'Message' , 'content' => $_SESSION['redirect_message'] , 'weight' => 0 ) ) ;
$this->_tpl_vars['xoops_showcblock'] = 1 ;
unset( $_SESSION['redirect_message'] ) ;
}
<{/php}>
What I can't figure to do is add a style to the message like <span style="background: #ff0000">. I'd like to make it stand out with red. Can anyone suggest?
EDIT: Apparently this hack was originall done by Peak Xoops
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=70