Globals and Common Functions

When you program, there are quite a few globals and functions that can be called by the block, module or theme that you're creating. This section is here to list the most commonly used and what they're for.

Common Globals

\$bgcolor1First Background Color as defined in the themes. Normally matches the background color of the tables the module use.
\$bgcolor2Second background color. Many purposes for this color, normally as a darker color for tables etc. Again, defined in the theme.
\$textcolor1Primary text color used in the theme
\$textcolor2Secondary text color used in the theme
\$dbThis calls the database functions, as talked about in the Database Integration section of this developers guide
\$prefixThis is so you can allow for users who don't use nuke as a prefix to their database tables
\$user_prefixSame as \$prefix except that it is specific to the Users table (in case it's different from the rest of the database).
\$userinfoThis is used to call the information about the user currently browsing the page. It's an array using variables like user_id, username, user_email and the like.
\$ThemeSelThis is used in themes so that the theme's directory can be renamed without causing problems with image paths etc.
\$module_nameName of the modlue currently being viewed - must be defined at the beginning of the module file
\$module_dirDirectory relative to the site root directory that the module is in. Again, needs to be defined at the top of the module
\$userUser Cookie. Used in the isuser function (see below)
\$adminAdmin cookie. Used in the isadmin function (see below)
"; ?>

This doesn't account for all of the globals. There are dozens more, but you won't use or need most of them.

Common Functions

These are the functions found in Nuke that can be called from any module etc.

get_lang(\$module_name); This is used to initialise the language files of the module you are viewing. Blocks have their language definitions in the main /language/lang-\$language.php files
isuser(\$user) This is used to check to see if the person currently viewing the page is a logged in member of the site. Normally it's encased in an if statement
isadmin(\$admin)Admin version of the isuser function. Again, normally used to check if user is a logged in admin and normally encased inside an if statement
title(\$title);This is to define the title for your module. It opens a full-width table which displays the title in the center of the box in a heading font
OpenTable();Opens a full-width table in the theme's colors. Normally used to contian pages for modules.
CloseTable();Closes a table opened with OpenTable();
OpenTable2();Opens a table which matches the width it's contents require (no width set). In the theme's colors. Normally contains any information within an OpenTable(); table which needs to be seperate, but still contained within the large table.
CloseTable2();Closes the smaller table opened in OpenTable2();


"; ?>