Search:
  Login Register Help
API Documentation
Choose a stylesheet:

Namespacedojo

Jump to PropertiesJump to FunctionsJump to ConstructorsNamespacesBack to top

Browser history management resources
Utility for unobtrusive/progressive event binding, DOM traversal, and manipulation.
transformation of relevant pieces of the Unicode.org Common Locale Data Repository (see http://unicode.org/cldr) to JSON from the original XML with associated utility classes
Color utilities
localized formatting and parsing routines for currencies
A uniform data access layer
Date manipulation utilities
Drag and Drop resources
Effects library on top of Base animations
Utility classes to enable loading of resources for internationalization (i18n)
Additional I/O transports (Ajax)
localized formatting and parsing routines for Number
Regular expressions and Builder resources
Dojo remote-procedure-call resources
String utilities for Dojo

Jump to PropertiesJump to FunctionsJump to NamespacesConstructorsBack to top

A registry to make contextual calling/searching easier.
Returns an animation that will transition the properties of node defined in 'args' depending how they are defined in 'args.properties'
takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another dojo.Color object
Constructordojo.Deferred(canceller: Function?)
Encapsulates a sequence of callbacks in response to a value that may not yet be available. This is modeled after the Deferred class from Twisted <http://twistedmatrix.com>.
Constructordojo.DeferredList(list: Array, fireOnOneCallback: Boolean?, fireOnOneErrback: Boolean?, consumeErrors: Boolean?, canceller: Function?)
Provides event handling for a group of Deferred objects.
signal fired when initial environment and package loading is complete. You may use dojo.addOnLoad() or dojo.connect() to this method in order to handle initialization tasks that require the environment to be initialized. In a browser host, declarative widgets will be constructed when this function finishes runing.
dojo.NodeList is as subclass of Array which adds syntactic sugar for chaining, common iteration operations, animation, and node manipulation. NodeLists are most often returned as the result of dojo.query() calls.
dojo._Line is the object used to generate values from a start value to an end value
Constructor to create an object representing a URL. It is marked as private, since we might consider removing or simplifying it.
Internal xd loader function. Clears the interval timer used to check on the status of in-flight xd module resource requests.
Internal xd loader function. Resets the xd state.
Internal xd loader function. Monitors in-flight requests for xd module resources.
Constructordojo.__FadeArgs(node: DOMNode|String, duration: Integer?, easing: Function?)
Constructordojo.__IoCallbackArgs(args: Object, xhr: XMLHttpRequest, url: String, query: String, handleAs: String, id: String, canDelete: Boolean, json: Object)
In addition to the properties listed for the dojo._IoArgs type, the following properties are allowed for dojo.xhr* methods.

Jump to PropertiesJump to ConstructorsJump to NamespacesFunctionsBack to top

Adds the specified classes to the end of the class list on the passed node.
Registers a function to be triggered after the DOM has finished loading and widgets declared in markup have been instantiated. Images and CSS files may or may not have finished downloading when the specified function is called. (Note that widgets' CSS and HTML code is guaranteed to be downloaded before said widgets are instantiated.)
registers a function to be triggered when the page unloads. In a browser enviroment, the functions will be triggered during the window.onbeforeunload event. Be careful doing work during window.onbeforeunload. onbeforeunload can be triggered if a link to download a file is clicked, or if the link is a javascript: link. In these cases, the onbeforeunload event fires, but the document is not actually destroyed. So be careful about doing destructive operations in a dojo.addOnUnload callback.
registers a function to be triggered when window.onunload fires. Be careful trying to modify the DOM or access JavaScript properties during this phase of page unloading: they may not always be available. Consider dojo.addOnUnload() if you need to modify the DOM or do heavy JavaScript work.
Functiondojo.anim(node: DOMNode|String, properties: Object, duration: Integer?, easing: Function?, onEnd: Function?, delay: Integer?)
A simpler interface to `dojo.animateProperty()`, also returns an instance of `dojo._Animation` but begins the animation immediately, unlike nearly every other Dojo animation API.
Functiondojo.attr(node: DomNode|String, name: String|Object, value: String?)
Gets or sets an attribute on an HTML element.
blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend, can reuse a previously allocated dojo.Color object for the result
Return the body element of the document return the body object associated with dojo.doc
Returns DOM node with matching `id` attribute or `null` if not found, similar to "$" function in another library. If `id` is a DomNode, this function is a no-op.
Clones objects (including DOM nodes) and all children. Warning: do not clone cyclic structures.
builds a color from 1, 2, 3, or 4 element array
converts a hex string with a '#' prefix to a color object. Supports 12-bit #rgb shorthand.
get rgb(a) array from css-style color declarations
parses str for a color value.
Functiondojo.connect(obj: Object|null, event: String, context: Object|null, method: String|Function, dontFix: Boolean): Handle
Create a link that calls one function when another executes.
Ensure that everytime obj.event() is called, a message is published on the topic. Returns a handle which can be passed to dojo.disconnect() to disable subsequent automatic publication on the topic.
Getter/setter for the content-box of node.
Get or set a cookie.
Functiondojo.coords(node: DomNode|String, includeScroll: Boolean?)
Returns an object that measures margin box width/height and absolute positioning data from dojo._abs().
Functiondojo.declare(className: String, superclass: Function|Function[], props: Object): Function
Create a feature-rich constructor from compact notation
Functiondojo.delegate(obj: The, props: an)
returns a new object which "looks" to obj for properties which it does not have a value for. Optionally takes a bag of properties to seed the returned object with initially.
Functiondojo.deprecated(behaviour: String, extra: String?, removal: String?)
Log a debug message to indicate that a behavior has been deprecated.
Remove a link created by dojo.connect.
Functiondojo.eval(scriptFragment: String): Object
Perform an evaluation in the global scope. Use this rather than calling 'eval()' directly.
Functiondojo.every(arr: Array|String, callback: Function|String, thisObject: Object?): Boolean
Determines whether or not every item in arr satisfies the condition implemented by callback.
determine if an object supports a given method
Functiondojo.exit(exitcode)
Functiondojo.experimental(moduleName: String, extra: String?)
Marks code as experimental.
Functiondojo.extend(constructor: Object, props: Object...): Object
Adds all properties and methods of props to constructor's prototype, making them available to all instances created with constructor.
Returns an animation that will fade node defined in 'args' from its current opacity to fully opaque.
Returns an animation that will fade node defined in 'args' from its current opacity to fully transparent.
Functiondojo.filter(arr: Array, callback: Function|String, thisObject: Object?): Array
Returns a new Array with those items from arr that match the condition implemented by callback.
Functiondojo.fixEvent(evt: Event, sender: DOMNode)
normalizes properties on the event object including event bubbling methods, keystroke normalization, and x/y positions
Functiondojo.forEach(arr: Array|String, callback: Function|String, thisObject: Object?)
for every item in arr, callback is invoked. Return values are ignored.
Functiondojo.formToJson(formNode: DOMNode|String, prettyPrint: Boolean?): String
return a serialized JSON string from a form node or string ID identifying the form to serialize
dojo.formToObject returns the values encoded in an HTML form as string properties in an object which it then returns. Disabled form elements, buttons, and other non-value form elements are skipped. Multi-select elements are returned as an array of string values.
Returns a URL-encoded string representing the form passed as either a node or string ID identifying the form to serialize
Parses a [JSON](http://json.org) string to return a JavaScript object. Throws for invalid JSON strings.
Returns a "computed style" object.
Functiondojo.getObject(name: String, create: Boolean, context: Object): Object
Get a property from a dot-separated string, such as "A.B.C"
Returns true if the requested attribute is specified on the given element, and false otherwise.
Returns whether or not the specified classes are a portion of the class list currently applied to the node.
Returns a function that will only ever execute in the a given scope. This allows for easy use of object member functions in callbacks and other places in which the "this" keyword may otherwise not reference the expected scope. Any number of default positional arguments may be passed as parameters beyond "method". Each of these values will be used to "placehold" (similar to curry) for the hitched function.
Functiondojo.indexOf(array: Array, value: Object, fromIndex: Integer?, findLast: Boolean?): Number
locates the first index of the provided value in the passed array. If the value is not found, -1 is returned.
Returns true if it is a built-in function or some other kind of oddball that *should* report as a function but doesn't
Return true if it is an Array
similar to dojo.isArray() but more permissive
Returns true if node is a descendant of ancestor
Return true if it is a Function
Returns true if it is a JavaScript object (or an Array, a Function or null)
Return true if it is a String
Functiondojo.lastIndexOf(array: Array, value: Object, fromIndex: Integer?): Number
locates the last index of the provided value in the passed array. If the value is not found, -1 is returned.
Executes a function that needs to be executed for the loader's dojo.requireIf resolutions to work. This is needed mostly for the xdomain loader case where a function needs to be executed to set up the possible values for a dojo.requireIf call.
Functiondojo.map(arr: Array|String, callback: Function|String, thisObject: Function?): Array
applies callback to each element of arr and returns an Array with the results
Getter/setter for the margin-box of node.
Functiondojo.mixin(obj: Object, props: Object...): Object
Adds all properties and methods of props to obj and returns the (now modified) obj.
Returns a `dojo._Url` object relative to a module.
takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
similar to hitch() except that the scope object is left to be whatever the execution context eventually becomes.
Attempt to insert node into the DOM, choosing from various positioning options. Returns true if successful, false otherwise.
require one or more modules based on which host environment Dojo is currently operating in
Functiondojo.provide(resourceName): Object
Each javascript source file must have at least one `dojo.provide()` call at the top of the file, corresponding to the file name. For example, `js/dojo/foo.js` must have `dojo.provide("dojo.foo");` before any calls to `dojo.require()` are made.
Functiondojo.publish(topic: String, args: Array)
Invoke all listener method subscribed to topic.
Returns nodes which match the given CSS3 selector, searching the entire document by default but optionally taking a node to scope the search by. Returns an instance of dojo.NodeList.
returns an object representing a de-serialized query section of a URL. Query keys with multiple values are returned in an array.
maps a module name to a path
Removes an attribute from an HTML element.
Removes the specified classes from node.
Functiondojo.require(moduleName: String, omitModuleCheck: Boolean?)
loads a Javascript module from the appropriate URI
Functiondojo.requireIf(condition: Boolean, resourceName: String)
If the condition is true then call dojo.require() for the specified resource
Functiondojo.requireLocalization(moduleName: String, bundleName: String, locale: String?, availableFlatLocales: String)
Declares translated resources and loads them if necessary, in the same style as dojo.require. Contents of the resource bundle are typically strings, but may be any name/value pair, represented in JSON format. See also `dojo.i18n.getLocalization`.
Functiondojo.setContext(globalObject: Object, globalDocument: DocumentElement)
changes the behavior of many core Dojo functions that deal with namespace and DOM lookup, changing them to work in a new global context (e.g., an iframe). The varibles dojo.global and dojo.doc are modified as a result of calling this function and the result of `dojo.body()` likewise differs.
Functiondojo.setObject(name: String, value: Object, context: Object?): Object
Set a property from a dot-separated string, such as "A.B.C"
enable or disable selection on a node
Functiondojo.some(arr: Array|String, callback: Function|String, thisObject: Object?): Boolean
Determines whether or not any item in arr satisfies the condition implemented by callback.
prevents propagation and clobbers the default action of the passed event
Accesses styles on a node. If 2 arguments are passed, acts as a getter. If 3 arguments are passed, acts as a setter.
Functiondojo.subscribe(topic: String, context: Object|null, method: String|Function): Handle
Attach a listener to a named topic. The listener function is invoked whenever the named topic is published (see: dojo.publish). Returns a handle which is needed to unsubscribe this listener.
Functiondojo.toggleClass(node: DomNode|String, classStr: String, condition: Boolean?)
Adds a class to node if not present, or removes if present. Pass a boolean condition if you want to explicitly add or remove.
Functiondojo.toJson(it: Object, prettyPrint: Boolean?, _indentStr: String?): null | String
Returns a [JSON](http://json.org) serialization of an object.
trims whitespaces from both sides of the string
signal fired by impending environment destruction. You may use dojo.addOnUnload() or dojo.connect() to this method to perform page/application cleanup methods. See dojo.addOnUnload for more info.
Remove a topic listener.
signal fired by impending window destruction. You may use dojo.addOnWIndowUnload() or dojo.connect() to this method to perform page/application cleanup methods. See dojo.addOnWindowUnload for more info.
Functiondojo.withDoc(documentObject: Object, callback: Function, thisObject: Object?, cbArguments: Array?)
Call callback with documentObject as dojo.doc. If provided, callback will be executed in the context of object thisObject
Functiondojo.withGlobal(globalObject: Object, callback: Function, thisObject: Object?, cbArguments: Array?)
Call callback with globalObject as dojo.global and globalObject.document as dojo.doc. If provided, globalObject will be executed in the context of object thisObject
Functiondojo.xdRequireLocalization(moduleName: String, bundleName: String, locale: String?, availableFlatLocales: String)
Internal xd loader function. The xd version of dojo.requireLocalization.
Functiondojo.xhr(method: String, args: dojo.__XhrArgs, hasBody: Boolean?): dojo.Deferred
Sends an HTTP request with the given method.
Sends an HTTP DELETE request to the server.
Sends an HTTP GET request to the server.
Sends an HTTP POST request to the server. In addtion to the properties listed for the dojo.__XhrArgs type, the following property is allowed: postData: String. Send raw data in the body of the POST request.
Sends an HTTP PUT request to the server. In addtion to the properties listed for the dojo.__XhrArgs type, the following property is allowed: putData: String. Send raw data in the body of the PUT request.
Functiondojo._abs(node: DomNode, includeScroll: Boolean?): Object
Gets the position of the passed element relative to the viewport (if includeScroll==false), or relative to the document root (if includeScroll==true). Returns an object of the form: { x: 100, y: 300 } if includeScroll is passed, the x and y values will include any document offsets that may affect the position relative to the viewport.
The default easing function for dojo._Animation(s)
removes node from its parent, clobbers it and all of its children.
Functiondojo._disconnect(obj, event, handle, listener)
Adds escape sequences for non-visual characters, double quote and backslash and surrounds with double quotes to form a valid string literal.
Functiondojo._everyOrSome(every: Boolean, arr: Array|String, callback: Function|String, thisObject: Object?): Boolean
Returns an animation that will fade the node defined by args.node from the start to end values passed (args.start args.end) (end is mandatory, start is optional)
Functiondojo._filterQueryResult(nodeList, simpleFilter)
Functiondojo._fireCallback(callback, context, cbArguments)
Functiondojo._getBorderBox(node, computedStyle)
returns an object with properties useful for noting the border dimensions. * l/t = the sum of left/top border (respectively) * w = the sum of the left and right border * h = the sum of the top and bottom border The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Functiondojo._getContentBox(node, computedStyle)
Returns an object that encodes the width, height, left and top positions of the node's content box, irrespective of the current box model.
Functiondojo._getMarginBox(node: DomNode, computedStyle: Object)
returns an object that encodes the width, height, left and top positions of the node's margin box.
Functiondojo._getMarginExtents(n, computedStyle)
returns object with properties useful for box fitting with regards to box margins (i.e., the outer-box). * l/t = marginLeft, marginTop, respectively * w = total width, margin inclusive * h = total height, margin inclusive The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Converts a module name in dotted JS notation to an array representing the path in the source tree
Returns the current opacity of the passed node as a floating-point value between 0 and 1.
returns object with properties useful for box fitting with regards to padding. * l/t = the sum of left/top padding and left/top border (respectively) * w = the sum of the left and right padding and border * h = the sum of the top and bottom padding and border The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Functiondojo._getPadExtents(n: DomNode, computedStyle: Object)
Returns object with special values specifically useful for node fitting. * l/t = left/top padding (respectively) * w = the total of the left and right padding * h = the total of the top and bottom padding If 'node' has position, l/t forms the origin for child nodes. The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.
Functiondojo._getProp(parts: Array, create: Boolean, context: Object): mixed
Functiondojo._getText(uri: URI, fail_ok: Boolean): null | String
Read the contents of the specified uri and return those contents.
Functiondojo._hitchArgs(scope, method: ,...): mixed
Functiondojo._ieDispatcher(args, sender)
Adds query params discovered by the io deferred construction to the URL. Only use this for operations which are fundamentally GET-type operations.
Cancels all pending IO requests, regardless of IO type (xhr, script, iframe).
Functiondojo._ioSetArgs(args: dojo.__IoArgs, canceller: Function, okHandler: Function, errHandler: Function)
sets up the Deferred and ioArgs property on the Deferred so it can be used in an io call.
Functiondojo._ioWatch(dfd: Deferred, validCheck: Function, ioCheck: Function, resHandle: Function)
watches the io request represented by dfd to see if it completes.
True if the node is BUTTON or INPUT.type="button".
Functiondojo._loadPath(relpath: String, module: String?, cb: Function?): Boolean
Load a Javascript module given a relative path
Loads JavaScript from a URI
calls loadUri then findModule and returns true if both succeed
Adds all properties and methods of props to obj. This addition is "prototype extension safe", so that instances of objects will not pass along prototype defaults.
Functiondojo._onto(arr, obj, fn)
Functiondojo._setBox(node: DomNode, l: Number?, t: Number?, w: Number?, h: Number?, u: String?)
sets width/height/left/top in the current (native) box-model dimentions. Uses the unit passed in u.
Functiondojo._setContentSize(node: DomNode, widthPx: Number, heightPx: Number, computedStyle: Object)
Sets the size of the node's contents, irrespective of margins, padding, or borders.
Functiondojo._setMarginBox(node: DomNode, leftPx: Number?, topPx: Number?, widthPx: Number?, heightPx: Number?, computedStyle: Object)
sets the size of the node's margin box and placement (left/top), irrespective of box model. Think of it as a passthrough to dojo._setBox that handles box-model vagaries for you.
set the opacity of the passed node portably. Returns the new opacity of the node.
Functiondojo._toArray(obj: Object, offset: Number?, startWith: Array?)
Converts an array-like object (i.e. arguments, DOMCollection) to an array. Returns a new Array with the elements of obj.
Functiondojo._toPixelValue(element, value, avalue)
True if the node uses border-box layout.
Functiondojo._xdCreateResource(contents: String, resourceName: String, resourcePath: String): String
Internal xd loader function. Creates an xd module source given an non-xd module contents.
Internal xd loader function. Does a depth first, breadth second search and eval of required modules.
Figure out whether the path is local or x-domain If there is a colon before the first / then, we have a URL with a protocol.
Functiondojo._xdLoadFlattenedBundle(moduleName: String, bundleName: String, locale: String?, bundleData: Object)
Internal xd loader function. Used when loading a flattened localized bundle via a script tag.
Internal xd loader function. Called by an xd module resource when it has been loaded via a script tag. Evaluate the function with scopeArgs for multiversion support.
Internal xd loader function. Determines what to do with a dependency that was listed in an xd version of a module contents.
Internal xd loader function. Walks the requires and evaluates module resource contents in the right order.
does the work of portably generating a new XMLHTTPRequest object.

Jump to FunctionsJump to ConstructorsJump to NamespacesPropertiesBack to top

The root relative path to dojo.js (as a string)
Alias for the current document. 'dojo.doc' can be modified for temporary context shifting. Also see dojo.withDoc().
Alias for the global scope (e.g. the window object in a browser).
True if the client is a web-browser
| undefined Version as a Number if client is FireFox. undefined otherwise. Corresponds to major detected FireFox version (1.5, 2, 3, etc.)
| undefined Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to major detected IE version (6, 7, 8, etc.)
| undefined Version as a Number if client is a KTHML-derived browser (Konqueror, Safari, etc.). undefined otherwise. Corresponds to major detected version.
| undefined Version as a Number if client is a Mozilla-based browser (Firefox, SeaMonkey). undefined otherwise. Corresponds to major detected version.
| undefined Version as a Number if client is Opera. undefined otherwise. Corresponds to major detected version.
| undefined Version as a Number if client is Safari or iPhone. undefined otherwise.
Detect spidermonkey
definitions for common key values
the locale as defined by Dojo (read-only)
D.O.H. Test files for Dojo unit testing.
version number of dojo

Navigating the Dojo API Tool

There are several different methods of navigating through the object structure of the Dojo Toolkit:

  • Use the namespace list (to the left). The simplest method would be to use the list of namespaces defined by the Dojo Toolkit, on the left side of every page.
  • Drill-down from where you are. The API Tool was designed to give you as much information via drill-down as possible. Everything defined in an object can be clicked on, for more information.
  • Use the search. At the top of the namespace list to the left is a search box; type in the terms you are looking for, and you will be taken to a result page that spans the entire toolkit.
Move to different sections

In addition, objects with large numbers of contained types have a simple way of jumping to sections on a page; simply look at the right side of any heading, and you will see a set of quick navigation icons. Clicking a type icon will take you to that section; clicking the up arrow icon will return you to the top of the page.

Inherited and private members

Show or hide variable types

The Dojo API Tool will show the full ancestry of an object's members (including how that member was defined and whether or not it overrides an original). By default, all members of an object that are inherited are shown with the object's API listing, and all private members are hidden.

To toggle either inherited or private members, look just beneath the breadcrumb bar (above the name of the object you are viewing) and click the appropriate link.

Switching styles

Choose a style

The Dojo API Tool was designed with several themes in mind; we know that some people prefer light on dark, while others might prefer dark on light. With this in mind, two themes (Noir and Blanc) are currently available, with more on the way.

To switch visual styles, click on the theme you want to use, near the top right corner of the page. The API Tool will remember which style you prefer and automatically load that theme on subsequent visits.

Key/Legend

Namespace Namespaces
A namespace in Dojo parlance is an object/property bag that can contain almost anything: constructors, methods, properties, etc. Usually is expressly defined to serve a particular purpose; for example, dojo.date.locale is a namespace defined to deal with locale-specific date handling.
Constructor Constructors
A constructor is a function designed to create instances of objects. With the Dojo Toolkit, there are two ways of creating constructors: the "old school" way (i.e. defining a function with the this keyword in the body) or using dojo.declare.
Singleton Singletons
A singleton is a constructor that is defined and then immediately executed so that only one instance may ever exist during an application's lifetime. Usually this is done to capture some information in the environment, or to ensure a set of private variables that cannot be accessed from outside of the declaration. Examples include dojox.encoding.crypto.Blowfish.

Data Types

Array Array
Arrays are ordered lists, native to Javascript.
Boolean Boolean
Native data type representing a simple "true/false" value.
Date Date
Native Javascript data type to handle common date and time representations.
DOMNode Node
An object that represents any kind of element being referenced/used by Javascript code. Note that the type of element is not dictated by this data type; only that it is a node of some sort.
Error Error
A special, native Javascript object used to indicate an error in code. Can be subclassed and used in conjunction with the throw statement, i.e. throw new MySubError(...);
Function Function
Functions/methods are pieces of invocable code; in JavaScript, they are also considered data and can be passed around like any other object.
Number Number
A Number object is used to represent any kind of numeric value; note that Javascript does not guarentee the actual underlying datatype (though the most common is a 64-bit float).
Object Object
Objects are the base data type of Javascript. With the Dojo API Tool, a type that cannot be determined is usually marked with this icon, in addition to straight objects.
Regular Expression RegExp (Regular Expression)
A regular expression is an object used for fast string search and parsing.
String String
A string is any sequence of characters.

Input formats

  • Filtered HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

      This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy.

      For more information see W3C's HTML Specifications or use your favorite search engine to find other sites that explain HTML.

      Most unusual characters can be directly entered without any problems.

      If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML's entities page.

    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • PHP code:
    • Using custom PHP code

      If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.

      Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.

      Notes:

      • You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.
      • register_globals is now set to off by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.
      • You can either use the print or return statement to output the actual content for your item.

      A basic example:

      You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:

      print t("Welcome visitor, ... welcome message goes here ...");
      								

      If we are however dealing with a registered user, we can customize the message by using:

      global $user;
      if ($user->uid) {
      	print t("Welcome $user->name, ... welcome message goes here ...");
      }
      else {
      	print t("Welcome visitor, ... welcome message goes here ...");
      }
      								

      For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.

  • Full HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • Markdown:
    • Quick Tips:
      • Two or more spaces at a line's end = Line break
      • Double returns = Paragraph
      • *Single asterisks* or _single underscores_ = Emphasis
      • **Double** or __double__ = Strong
      • This is [a link](http://the.link.com "The optional title text")
      For complete details on the Markdown syntax, see the Markdown documentation.