xoops forums

goffy

Just can't stay away
Posted on: 2019/7/26 7:47
goffy
goffy (Show more)
Just can't stay away
Posts: 417
Since: 2010/12/27
#1

Warning with xoInboxCount

hi

I am currently redesigning myxoops.org and I have a problem with "xoInboxCount" where I need support
Quote:
Warning: Use of undefined constant xoInboxCount - assumed 'xoInboxCount' (this will throw an Error in a future version of PHP) in Datei /.../myxoops.org/myxoops/secure/xoops_data/caches/smarty_compile/e7ff34f6-system-myxoops2019-default^%%C2^C23^C2339D63%%nav-menu.tpl.php

how can I solve this?

iHackCode

Module Developer
Posted on: 2019/7/26 22:19
iHackCode
iHackCode (Show more)
Module Developer
Posts: 1037
Since: 2004/6/29
#2

Re: Warning with xoInboxCount

Do you have a function.xoInboxCount.php file in htdocs/class/smarty/xoops_plugins ?

goffy

Just can't stay away
Posted on: 2019/7/28 12:38
goffy
goffy (Show more)
Just can't stay away
Posts: 417
Since: 2010/12/27
#3

Re: Warning with xoInboxCount

hi

yes, and it provides the number of unread messages in a proper way

geekwright

Quite a regular
Posted on: 2019/7/28 17:11
geekwright
geekwright (Show more)
Quite a regular
Posts: 302
Since: 2010/10/15
#4

Re: Warning with xoInboxCount

I've not seen this. Can you email me the nav-menu.tpl template file and the nav-menu.tpl.php compiled version so I can look at what it is doing?

goffy

Just can't stay away
Posted on: 2019/7/29 5:46
goffy
goffy (Show more)
Just can't stay away
Posts: 417
Since: 2010/12/27
#5

Re: Warning with xoInboxCount

sent

geekwright

Quite a regular
Posted on: 2019/7/29 23:30
geekwright
geekwright (Show more)
Quite a regular
Posts: 302
Since: 2010/10/15
#6

Re: Warning with xoInboxCount

Here is a quick review of the problem Goffy experienced for anyone following along. This will NOT work and triggers the warning:
<{if xoInboxCount}> ... <{/if}>
This will work:
<{xoInboxCount assign="unreadCount"}> <{if $unreadCount}> ... <{/if}>
The output of xoInboxCount goes straight to the page output. Using the assign parameter assigns the count to variable that can be used with the "if" function.

goffy

Just can't stay away
Posted on: 2019/7/30 5:11
goffy
goffy (Show more)
Just can't stay away
Posts: 417
Since: 2010/12/27
#7

Re: Warning with xoInboxCount

hi geekwright

many thanks for help and explanation

alain01

Quite a regular
Posted on: 12/8 0:29
alain01
alain01 (Show more)
Quite a regular
Posts: 389
Since: 2003/6/20
#8

Re: Warning with xoInboxCount

Yes, thanks,
but another question :

How can i subtract <{$inbox_total}>-<{$unread_count}>

It 's display : "4-3", not"1"


<li class="nav-item">
            <
class="nav-link" href="<{$xoops_url}>/viewpmsg.php">
            <{if 
$unread_count}> 
                <
span style="font-size: 20px;" class="mx-auto xoopsinactive-color fas fa-envelope"></span> <span class="badge badge-pill badge-danger align-text-top"><{$unread_count}></span>
            <{/if}>
                <
span style="font-size: 20px;" class="mx-auto xoopsinactive-color fas fa-envelope-open"></span> <span class="badge badge-pill badge-secondary"><{$inbox_total}>-<{$unread_count}></span>
            </
a>
        </
li>

alain01

Quite a regular
Posted on: 12/8 0:32
alain01
alain01 (Show more)
Quite a regular
Posts: 389
Since: 2003/6/20
#9

Re: Warning with xoInboxCount

Link to the file /class/smarty/xoops_plugins/function.xoInboxCount.php
https://github.com/XOOPS/XoopsCore25/b ... function.xoInboxCount.php

With this subject, i discover the directory /class/smarty/xoops_plugins.
So cool !

Ok ok, i could discovered 10 years ago...

alain01

Quite a regular
Posted on: 12/8 0:51
alain01
alain01 (Show more)
Quite a regular
Posts: 389
Since: 2003/6/20
#10

Re: Warning with xoInboxCount

Yesssssss, found !

Quote:
Math and embedding tags:

{$x+$y} // will output the sum of x and y.
{assign var=foo value=$x+$y} // in attributes
{$foo[$x+3]} // as array index
{$foo={counter}+3} // tags within tags
{$foo="this is message {counter}"} // tags within double quoted strings


so i can use : <{$inbox_total-$unread_count}>

Resized Image


Now code is :
<{xoInboxCount assign="unread_count" total='inbox_total'}>
        <
li class="nav-item">
            <
class="nav-link" href="<{$xoops_url}>/viewpmsg.php">
            <{if 
$unread_count}> 
                <
span style="font-size: 20px;" class="mx-auto xoopsinactive-color fas fa-envelope"></span> <span class="badge badge-pill badge-danger align-text-top"><{$unread_count}></span>
            <{/if}>
                <
span style="font-size: 20px;" class="mx-auto xoopsinactive-color fas fa-envelope-open"></span> <span class="badge badge-pill badge-secondary align-text-top"><{$inbox_total-$unread_count}></span>
            </
a>
        </
li>