16
Quote:
LazyBadger wrote:
No problem with embedding any block, main problem is transparent I18n'ion of included parts
What is "I18n'ion"?
Stefan,
You could create a file in the class/smarty/plugins/ folder called insert.messages.php with this in it
<?
function smarty_insert_pms()
{
GLOBAL $xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid = $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $uid));
$msgcount = $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount', $msgcount);
}
?>
Then erase your <!--php stuff and put in instead <{insert name="messages"}>
That would clean it up a bit.
Also, since the link is the same regardless of new messages or not and only the img, and/or alt text changes, you could put the if statement around the img tags, instead of the anchor tags, and get rid of one of those.
Like this
<a href="<{$xoops_url}>/viewpmsg.php">
<{if $msgcount > 0}>
<img src="<{$xoops_imageurl}>images/prvmsg_on.jpg" alt=You have <{$msgcount}>
new message border="0" />
<{else}>
<img src="<{$xoops_imageurl}>images/prvmsg_off.jpg"
alt="You have no new messages" border="0" />
<{/if}></a>
If you want it to be gramatically correct you could add anouther if statement so that if $msgcount > 1 it says messages with an s.
That is what I did anyway.
Have fun,
Steve
s l s h a n k l e @ b e l l s o u t h . n e t