Retired Documentation: You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.
Display Class
Usage of Display Class
The Display class provides all the HTML display elements used in the ExpressionEngine Control Panel. By creating this abstract layer, the Control Panel side of modules can be created without actually writing out a great deal of the HTML, especially the header and XHTML Strict design. In the Control Panel file for your module, the constructor function* of the module's Control Panel class will have a switch function used for navigation through the CP side of this module. Each case statement in the switch directs to a function in the class, and these functions used in the switch will either be used for displaying a page OR processing the content of a page. So, essentially, each page of the Control Panel side of your module is a function.
* the function with the same name as the class and is thus called every time the class is called
Three Important Class Variables
There are three class variables that should be set whenever creating a function in the module's CP class that will be used for displaying a page.
$DSP->title
Is used to set the content for the HTML <title> tag for the page. It should be set using a member of the language array, called via the Language class.
$DSP->title = $LANG->line('moblog');
$DSP->crumb
Is used for displaying the name of the current page within the naviagational (breadcrump) links at the top of the main body of the page. (ex: Control Panel Home > Modules > Moblogging).
$DSP->crumb = $LANG->line('moblog');
$DSP->body
Contains the main content of the page.
$DSP->body .= $DSP->heading($LANG->line('moblog_form')); $DSP->body .= $form_content;
Other Class Variables
There are other Display class variables that you may wish to use but that are not required for a Control Panel page to display properly.
$DSP->body_props
Is used to add content to the <body> HTML tag, such as javascript.
$DSP->body_props = " onLoad=\"document.forms[0].username.focus();\"";
$DSP->crumbline
Set to FALSE, if you wish the line underneath the breadcrump content not to be displayed.
$DSP->ref_rate
Rate of refresh in seconds for the <meta> tag when setting the $DSP->refresh class variable. By default it is set to 0.
$DSP->refresh
If set to a URL, the header will contain a <meta> refresh to that URL. Useful for creating some manner of batch processing.
$DSP->refresh = BASE.AMP.'C=communicate'.AMP.'M=batch_send'.AMP.'id='.$id; $DSP->ref_rate = 4;
$DSP->rcrumb
Used if you wish to create a right side breadcrump or link. Often used at the top of Control Panel section subpages for creating something like a new custom field.
$DSP->rcrumb = $DSP->qdiv('crumbLinksR', $DSP->anchor( BASE.AMP.'C=admin'.AMP.'M=blog_admin'.AMP.'P=edit_field', $LANG->line('create_new_custom_field') ));
$DSP->show_crumb
Set to FALSE, if you do not wish the breadcrumb navigation to be displayed.
Class Functions
Consult the list of functions in the Class Reference section.