1
TerryBogard
Calling external PHP to return vars - NOT in a block
  • 2004/3/18 9:38

  • TerryBogard

  • Just popping in

  • Posts: 8

  • Since: 2002/3/19


Hi again!
When I call a php-file (e.g. test.php) containing this:
le="color: #000000"><?php <? include "mainfile.php"; global $xoopsUser; if($xoopsUser){ echo "Hallo, ".$xoopsUser->uname(); echo "Logged In"; }else{ echo "Not Logged In"; } ?>

then it works okay, but how can I return $msgcount ???
Please Note:
I really need this to work from a single php-file (http://myXoopsUrl/test.php), neither in a block nor elsewhere inside xoops.
It that possible ?

2
TerryBogard
Re: Calling external PHP to return vars - NOT in a block
  • 2004/3/20 12:38

  • TerryBogard

  • Just popping in

  • Posts: 8

  • Since: 2002/3/19


still lookin for help...

3
Dave_L
Re: Calling external PHP to return vars - NOT in a block
  • 2004/3/20 12:56

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


What is $msgcount?

4
TerryBogard
Re: Calling external PHP to return vars - NOT in a block
  • 2004/3/20 14:56

  • TerryBogard

  • Just popping in

  • Posts: 8

  • Since: 2002/3/19


It´s the variable which shows how many unread messages are in someone´s inbox - it´s used in system_block_user.html and displays the number after 'inbox' and highlights the button if > 0.

5
Dave_L
Re: Calling external PHP to return vars - NOT in a block
  • 2004/3/20 15:47

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Do you mean $block.new_messages in modules/system/templates/blocks/system_block_user.html?

That's calculated in function b_system_user_show() in modules/system/blocks/system_blocks.php. Try this:

le="color: #000000"><?php error_reporting(E_ALL); #*#DEBUG# global $xoopsUser; 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'))); $new_messages = $pm_handler->getCount($criteria); echo "You have $new_messages new message(s).<br />n"; }


Since you're already checking $xoopsUser in the code you posted above, you really only need the body of the "if".

6
TerryBogard
FINALLY !!!
  • 2004/3/20 21:19

  • TerryBogard

  • Just popping in

  • Posts: 8

  • Since: 2002/3/19


Thanks so much Dave !!!
This finally works great !

I´ve made a hack from this and goin to upload it right away!


Thanx again for your help !

Here are the Files with instructions !

Who's Online

452 user(s) are online (391 user(s) are browsing Support Forums)


Members: 0


Guests: 452


more...

Donat-O-Meter

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

Latest GitHub Commits