You are missing our premiere tool bar navigation system! Register and use it for FREE!

•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 145 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to change the PHP-Nuke header depending on some global feature

14.3.3. How to change the PHP-Nuke header depending on some global feature

In some cases you may need to change the PHP-Nuke header according to some globally available information about the current user. For example, you may want to display a menu that is differently structured if the user's language is, say, french, leaving the standard menu structure untouched otherwise.

The key to such changes is always to declare the globally available feature as being "global" in the themeheader() function in theme.php. Then you can use its value for a simple check that will echo the right HTML incantations if the check succeeds. Let's take for example the above case, where the globally available feature is nothing else but the current language setting:

global $currentlang;
if ($currentlang == "french") {
  echo "<a href=\"/special/link/to/my/services/for/french/users\"><b>"
else if ($currentlang == "english") {
  echo "<a href=\"/some/default/link/for/other/users\">"

This code, put in the themeheader() function of theme.php in the aproppriate place (depending on where exacly you want it to appear), will display a special menu link if the user's language is french. Instead of the current language, any user setting that is globally available can be used. The only work you have to do is to find out which variable stores the global setting you need ($currentlang in the above example).

User information is stored in the userinfo array. This array is filled with a call to the getusrinfo() function. Thus a simple way to arrive at some information that is special to the currently logged-in user, is to write somethink like

    global $user, $userinfo;
    if(is_user($user)) {

You have then some user-specific settings at your disposal:

$name = $userinfo['uname'];
$uid = $userinfo['uid'];
$email_real = $userinfo['email'];
$email_fake = $userinfo['femail'];
$url = $userinfo['url'];
$avatar = $userinfo['user_avatar'];
$newsletter = $userinfo['newsletter'];
$icq = $userinfo['user_icq'];
$aim = $userinfo['user_aim'];
$yim = $userinfo['user_yim'];
$msnm = $userinfo['user_msnm'];
$location = $userinfo['user_from'];
$occupation = $userinfo['user_occ'];
$interests = $userinfo['user_intrest'];
$signature = $userinfo['user_sig'];
$biography = $userinfo['user_bio'];

and can use them in the same manner as $currentlang above to build a highly customized header.

Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.127 Seconds - 308 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::