1
DonXoop
Adding a new global variable?

I am looking for the "smart" way to add a global variable. Something akin to $xoops_isadmin except that the value will be true if the user is in a specified group.

In my theme I include a php file with code like:
Quote:

global $xoopsUser, $xoopsModule;
if (is_object($xoopsUser)) {
$showifFull="";
$desired_group = 14;
$groups = $xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS);
if (in_array($desired_group, $groups)) {
$this->assign("showifFull", TRUE) ;}
}


Now I can for example <{if $showifFull}>. I need the same variable in several places and would prefer a global variable that I can call from anywhere. In some cases I am presenting content based on that value (in my theme) or replacing the $xoops_isadmin variable so that a group of users can have access to a feature (like the shoutbox clear button).

I am looking for a clean way to do this and then have access to it in my theme and modules.

2
studioC
Re: Adding a new global variable?
  • 2004/11/27 16:22

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hello donXOOP,

this is an interesting topic. I'm used to assign smarties in index.php of modules if i only need them for special moduldisplay or add them in header.php if needed. But i feel this is not the way a coder would do.

perhaps a dev can bring us the candle here to enlight our heads?

cheers
michael

Login

Who's Online

358 user(s) are online (99 user(s) are browsing Support Forums)


Members: 0


Guests: 358


more...

Donat-O-Meter

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

Latest GitHub Commits