1
trspice
Show Xoops redirect page messages in theme - Xoops-magazine.com
  • 2007/12/17 0:09

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


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 '



line 128 in include/cp_functions.php






";

// start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "
\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// end

foreach ( $admin_mids as $adm ) {
if ( !empty($xoops_admin_menu_ft[$adm]) ) {
echo "";
}
}

--------------------------------------------------

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

".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."
".$xoops_admin_menu_ft[$adm]."





";

// start
if( ! empty( $_SESSION['redirect_message'] ) ) {
echo "
\n" ;
unset( $_SESSION['redirect_message'] ) ;
}
// end

foreach ( array_keys($xoops_admin_menu_ft) as $adm ) {
if ( in_array($adm, $admin_mids) ) {
echo "
";
}
}


-------------------------------------------------

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', '');
$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 . 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
There's nothing but science....
The Reggae Album

2
trspice
Re: Show Xoops redirect page messages in theme - Xoops-magazine.com
  • 2007/12/17 17:26

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


So does anyone know how to add a style to the message?

I tried the following but it didn't work;
Quote:

<{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}>
There's nothing but science....
The Reggae Album

3
jimmyx
Re: Show Xoops redirect page messages in theme - Xoops-magazine.com
  • 2007/12/17 18:57

  • jimmyx

  • Quite a regular

  • Posts: 338

  • Since: 2007/7/18


i myself also want to know the answer for your question

emmmm..there is also a diffrent redirect hack..an ajax redirect hack i think you might be interested.


http://xoops.peak.ne.jp/md/d3forum/index.php?topic_id=2710

4
trspice
Re: Show Xoops redirect page messages in theme - Xoops-magazine.com
  • 2007/12/18 0:31

  • trspice

  • Not too shy to talk

  • Posts: 193

  • Since: 2007/3/24


jimmyx, that solution is nice. Sorta like the Wordpress messages. Thanks
There's nothing but science....
The Reggae Album

Login

Who's Online

399 user(s) are online (271 user(s) are browsing Support Forums)


Members: 0


Guests: 399


more...

Donat-O-Meter

".htmlspecialchars($_SESSION['redirect_message'],ENT_QUOTES)."
".$xoops_admin_menu_ft[$adm]."
Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits