11
shank
Re: New messages in theme as smarty; how to?
  • 2005/12/12 14:47

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


The code in the theme should be wrapped with
<{if $xoops_isuser}>....code goes here....<{/if}>


edited to fix space in code.
s l s h a n k l e @ b e l l s o u t h . n e t

12
tjnemez
Re: New messages in theme as smarty; how to?
  • 2005/12/12 17:16

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


thanks for your help. i tried this but it does not work for me.

<{if$xoops_isuser}><{insert name="pms"}>

<{if $msgcount > 0}>
<{if $msgcount > 1}>You Have <{$msgcount}> New Messages
<{else}>You have <{$msgcount}> New Message
<{/if}>
<{else}>Private Messages
<{/if}>
<{/if}>
Not right now; I am busy screwing up my site!


Dream Catcher Dezines
Mind Health ...

13
blueteen
Re: New messages in theme as smarty; how to?
  • 2005/12/12 18:17

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


can you activate 'debug php mode'

14
supermario
Re: New messages in theme as smarty; how to?
  • 2005/12/12 23:13

  • supermario

  • Just popping in

  • Posts: 6

  • Since: 2005/10/15


Quote:
blueteen wrote:
can you activate 'debug php mode'


I'm having the same problem... it won't appear. I turned on PHP Debug and there were no errors that seemed to refer to this.

15
menochi
Re: New messages in theme as smarty; how to?
  • 2005/12/13 2:12

  • menochi

  • Friend of XOOPS

  • Posts: 259

  • Since: 2003/12/28


Perhaps this is an other solution for you?:

PMBLOCK by tuff (brandycoke)

in valid code we trust

16
shank
Re: New messages in theme as smarty; how to?
  • 2005/12/13 2:43

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Quote:

tjnemez wrote:
thanks for your help. i tried this but it does not work for me.

<{if$xoops_isuser}><{insert name="pms"}>

<{if $msgcount > 0}>
<{if $msgcount > 1}>You Have <{$msgcount}> New Messages
<{else}>You have <{$msgcount}> New Message
<{/if}>
<{else}>Private Messages
<{/if}>
<{/if}>


only thing I see wrong with this is there should be a space between <{if and $xoops_isuser}>

<{if $xoops_isuser}> is how it should look.

Did you create the insert.php file?
s l s h a n k l e @ b e l l s o u t h . n e t

17
shank
Re: New messages in theme as smarty; how to?
  • 2005/12/13 2:48

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Quote:

supermario wrote:
Quote:
blueteen wrote:
can you activate 'debug php mode'


I'm having the same problem... it won't appear. I turned on PHP Debug and there were no errors that seemed to refer to this.


Try smarty debug.

Also you may have to set in preferances to update template from theme folder.
s l s h a n k l e @ b e l l s o u t h . n e t

18
AAINC
Re: New messages in theme as smarty; how to?
  • 2005/12/13 3:58

  • AAINC

  • Not too shy to talk

  • Posts: 121

  • Since: 2003/10/18


This still works.


Create a php file and name it ex_assign.php

ex_assign.php
// $Id$
// FILE        ::    ex_assign.php
// AUTHOR    ::    Ryuji AMANO 
// WEB        ::    Ryu's Planning 
//

global $xoopsUser$xoopsModule;
if (
is_object($xoopsUser)) {
    
$pm_handler =& xoops_gethandler('privmessage');

    
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
    
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
    
$this->assign("ex_new_messages"$pm_handler->getCount($criteria));
}

if ( 
is_object($xoopsModule) ) {
    
$this->assign('ex_moduledir'$xoopsModule->getVar('dirname'));
}

?>


Put ex-assign.php inside the THEME folder.

Now call ex_assign.php into theme by placing the below code right after the body statement in the theme.html.
<{include_php file="$xoops_rootpath/themes/YOUR_THEME_NAME_HERE/ex_assign.php"}>


Now place the below code where you want the message alert to go inside the theme.html
<{if $ex_new_messages 1}>
<
a href="<{$xoops_url}>/viewpmsg.php">Private Messagesa>
<{/if}>
<{if 
$ex_new_messages 0}>
<{if 
$smarty.server.SCRIPT_NAME == "/index.php"}>
<
script language="javascript" type="text/javascript">

script>
<{/if}>
<
a  href="<{$xoops_url}>/viewpmsg.php">
<
span style="color:#ff6600;"><{$ex_new_messages}>-Message(s)
span>a>
<{/if}>


With this you not only have a Red link saying how many new messages you have, when you return to front page a popup tells you also. If no new messages it just says "Private Message, linking to the inbox.

I am sure someone could clean up and update, but this works in XOOPS 2 XOOPS 2.2 and XOOPS 2.2.3a.

19
tjnemez
Re: New messages in theme as smarty; how to?
  • 2005/12/13 4:06

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


shank,

it was the space, thanks alot for your help.
Not right now; I am busy screwing up my site!


Dream Catcher Dezines
Mind Health ...

20
NeoFenix
Re: New messages in theme as smarty; how to?
  • 2005/12/20 16:29

  • NeoFenix

  • Just popping in

  • Posts: 31

  • Since: 2005/7/8 3


Wonderful hack! ..... but I'm using x-ipb for forum control .... so isn't working for me .... please, help!

Login

Who's Online

162 user(s) are online (73 user(s) are browsing Support Forums)


Members: 0


Guests: 162


more...

Donat-O-Meter

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