PEAK XOOPS - Inbox counter on your theme in englishin japanese

Inbox counter on your theme

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/31 13:40
mariuss  ¸àĹ   Posts: 44
Hi,

I noticed that the theme you are using has a custom user menu once you login. Right under the menu bar you have "View Account, Edit Account, Notifications, Inbox, Bookmark".

I am using a similar theme but I have a problem with the "Inbox" menu, it does not show if you have new messages. Your theme is doing that.

Would you share the code you used to implement this?

Is your theme available for download?

Thanks,
Marius
Votes:114 Average:4.47
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/31 17:48
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi mariuss.

It is not so difficult to display the status of inbox if you use <{php}> <{/php}>.

This is a code fragment of my theme.

Since my theme is based on imago05, I can't re-destribute it. sorry.

<{php}>
global $xoopsModule , $xoopsUser ;
$xoops_url = XOOPS_URL ;
$submenu_str = "" ;
$mainmenu_str = "
  <tr> 
    <td class='head_menu_left' width='15'> </td>
    <td class='head_menu'>
      <div style='float:left;'><a href='$xoops_url/'>HOME</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/news/'>NEWS</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/mydownloads/'>DOWNLOADS</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/xhnewbb/'>FORUMS</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/piCal/'>piCal</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/myalbum/'>myAlbum-P</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/xhld0/'>xhld</a> |</div>
      <div style='float:left;'><a href='$xoops_url/modules/sitemap/'>sitemap</a> |</div>
      <!-- language selection -->
      <!-- <div style='float:right;'>
        <a href='$xoops_url/?easiestml_lang=xlang%3Aen' style='padding:0px;'><img src='$xoops_url/images/english.gif' alt='english' title='english' border='0' /></a>
        <a href='$xoops_url/?easiestml_lang=xlang%3Aja' style='padding:0px;'><img src='$xoops_url/images/japanese.gif' alt='japanese' title='japanese' border='0' /></a>
      </div> -->
    </td>
    <td class='head_menu_right'></td>
  </tr>\n" ;

if( isset( $xoopsModule ) && is_object( $xoopsModule ) ) {
	$dirname = $xoopsModule->getVar( 'dirname' ) ;
	$mainmenu_str = str_replace( "/modules/$dirname/'" , "/modules/$dirname/' style='background: #C0CCD9;'" , $mainmenu_str ) ;
	$sublinks =& $xoopsModule->subLink();
	if( count( $sublinks ) > 0 ) {
		$submenu_str .= "  <tr>\n    <td class='sub_menu_left' width='15'> </td>\n    <td class='sub_menu'>\n     " ;
		foreach( $sublinks as $sublink ) {
			$submenu_str .= "<a href='$xoops_url/modules/$dirname/{$sublink['url']}'>{$sublink['name']}</a> |\n";
		}
		$submenu_str .= "    </td>\n    <td class='sub_menu_right'></td>\n  </tr>\n" ;
	}
} else {
	$mainmenu_str = str_replace( "'>HOME</a>" , "' style='background: #C0CCD9;'>HOME</a>" , $mainmenu_str ) ;
}
if( is_object( $xoopsUser ) && strlen( $submenu_str ) < 1 ) {
	$pm_handler =& xoops_gethandler('privmessage');
	$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
	$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
	$new_messages = $pm_handler->getCount($criteria);
	if( $xoopsUser->isadmin() ) $admin_link = "<a href='$xoops_url/admin.php' target='_blank'>Admin</a>" ;
	if( $new_messages > 0 ) {
		$pm_str = "<span style='color:#ff0000; font-weight: bold;'> ($new_messages)</span>" ;
		$pm_class = "class='highlight'" ;
	} else {
		$pm_str = '' ;
		$pm_class = '' ;
	}
	$submenu_str .= "
	<tr>
	  <td class='sub_menu_left' width='15'> </td>
	  <td class='sub_menu'>     
	    <a href='$xoops_url/user.php'>View Account</a> |
	    <a href='$xoops_url/edituser.php'>Edit Account</a> |
	    <a href='$xoops_url/notifications.php'>Notifications</a> |
	    <a href='$xoops_url/viewpmsg.php' $pm_class>Inbox$pm_str</a> |
	    <a href='$xoops_url/modules/shiori/'>Bookmark</a> |
	    $admin_link
	  </td>
	  <td class='sub_menu_right'></td>
	</tr>\n" ;
}

echo $mainmenu_str ;
echo $submenu_str ;
<{/php}>


Votes:121 Average:4.96
Previous post - Next post | Parent - No child | Posted on 2005/6/2 13:16
mariuss  ¸àĹ   Posts: 44
Thanks a lot Gijoe!

While I was adding the code you suggested I realized that the theme I was using already supports this. It was not working because of a broken include.

The theme is artday (http://artday.org/), it mentions that it got the idea from a Japanese site:
http://jp.xoops.org/modules/newbb/viewtopic.php?topic_id=5060&forum=11

Votes:116 Average:5.26

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!