1
irmtfan
shoutbox 5.0 - how to add xoops_module_header smarty?
  • 2012/7/17 11:35

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


In shoutbox 5.0 by trabis:
http://xuups.googlecode.com/files/XOOPS2.4_mod_shoutbox_5.0_xuups.zip

I want to add xoops_module_header smarty variable to shoutbox module because this variable is needed in its iframe for customization.
You know we can use this variable like below in themes/templates:
<!-- customized header contents -->
    <{
$xoops_module_header}>


I added it to modules/shoutbox/templates/shoutbox_shoutframe.html
<{if (($myid =='guest' && $config.captcha_enable == && ($captchaerror || $addit==|| $double==1)) || ($config.captcha_enable == && $captchaerror))}>
        <
script>
          
top.window.location.href parent.location.href;
        </
script>
      <{/if}>

<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
    <
title>Shoutbox frame</title>
    <{if 
$addit==or $double==1}>
    <
script type="text/javascript">
    <!--
        var 
cbox top.xoopsGetElementById("xoopscaptcha");
        if (
cbox) {
          
top.xoopsGetElementById("xoopscaptcha").focus();
          
top.xoops_captcha_refresh("xoopscaptcha");
        }
        var 
ctext top.xoopsGetFormElement("shoutform","xoopscaptcha");
        if (
ctext) {
         
top.xoopsGetFormElement("shoutform","xoopscaptcha").value='';
         
top.xoopsGetFormElement("shoutform","xoopscaptcha").focus();
        }
        
top.xoopsGetElementById("shoutfield").value='';
        
top.xoopsGetElementById("shoutfield").focus();
        
    
//-->
    
</script>
    <{/if}>

    <{if 
$config.block_autorefresh==1}>
    <
script type="text/javascript">
    <!--
        var 
refreshtime=top.xoopsGetElementById("refreshtime").value;
        if (
top.xoopsGetElementById("shoutrefresh").checked)
        {
            
setTimeout('location.href="shoutframe.php"',refreshtime);
        }
    -->
    </
script>
    <{/if}>
    
    <
script type="text/javascript">
       
window.onload = function ()
      {
        if (!
document.getElementsByTagName) return;  
        var 
anchors document.getElementsByTagName("a"); 
        for (var 
count=0count<anchors.lengthcount++) { 
          var 
anchor anchors[count];  
          if (
anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){  
            
anchor.target "_blank";  
          } 
        }
      }
    </
script>
    
    <
style type='text/css' media='all'>
        @
import url(<{$themecss}>);
    </
style>
        <!-- 
customized header contents -->
    <{
$xoops_module_header}>

    <
meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" />
</
head>
<
body>
    <
table width='100%' border='0' cellpadding='0' cellspacing='0' style='padding: 0; margin: 0;'>
    <{foreach 
item=shout from=$shout}>
    <
tr style="width: 100%" class='<{cycle values="even,odd"}>' title='<{$shout.time}><{if $xoops_isadmin}> [<{$shout.ip}>]<{/if}>'>
            <{if 
$config.display_avatar}>
              <
td class='avatarblock' width='40' valign='top'>
                <{if 
$shout.uid neq 'guest' && $shout.avatar}>
                  <
img src='<{$shout.avatar}>' width='40'>
                <{elseif 
$shout.uid eq 'guest'}>
                  <{if 
$guestavatar}>
                    <
img src='<{$guestavatar}>' width='40'>
                  <{else}>
                    <
img src='<{$blankavatar}>' width='40'>
                  <{/if}>
                <{else}>
                  &
nbsp;
                <{/if}>
              </
td>
            <{/if}>
            <
td class='sideboxcontent'>
            <{if 
$shout.uid neq 'guest'}>
              <
b><a href='<{$xoops_url}>/userinfo.php?uid=<{$shout.uid}>' target='_top'><{$shout.uname}></a>:</b>
              <{
$shout.message}>
            <{else}>
              <
b><{$shout.uname}><font color='#990000'>*</font>:</b>
              <{
$shout.message}>
            <{/if}>
        </
td>
    </
tr>
    <{/foreach}>
    </
table>
</
body>
</
html>


but it didnt interpreted to what it is intended to be.
so i take a look into the module files and i found a shoutbox/header.php

I add below line to the shoutbox/header.php

include $GLOBALS['xoops']->path('header.php');


But still it dont work.
what can i do?

Login

Who's Online

239 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 239


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits