Elgg  Version 1.9
Functions | Variables
views.php File Reference

Go to the source code of this file.

Functions

 elgg_set_viewtype ($viewtype="")
 Manually set the viewtype. More...
 
 elgg_get_viewtype ()
 Return the current view type. More...
 
 elgg_register_viewtype ($viewtype)
 Register a viewtype. More...
 
 elgg_is_registered_viewtype ($viewtype)
 Checks if $viewtype is registered. More...
 
 _elgg_is_valid_viewtype ($viewtype)
 Checks if $viewtype is a string suitable for use as a viewtype name. More...
 
 elgg_register_viewtype_fallback ($viewtype)
 Register a viewtype to fall back to a default view if a view isn't found for that viewtype. More...
 
 elgg_does_viewtype_fallback ($viewtype)
 Checks if a viewtype falls back to default. More...
 
 elgg_register_ajax_view ($view)
 Register a view to be available for ajax calls. More...
 
 elgg_unregister_ajax_view ($view)
 Unregister a view for ajax calls. More...
 
 elgg_register_external_view ($view, $cacheable=false)
 Registers a view as being available externally (i.e. More...
 
 _elgg_is_view_cacheable ($view)
 Check whether a view is registered as cacheable. More...
 
 elgg_unregister_external_view ($view)
 Unregister a view for ajax calls. More...
 
 elgg_get_view_location ($view, $viewtype= '')
 Returns the file location for a view. More...
 
 elgg_set_view_location ($view, $location, $viewtype= '')
 Set an alternative base location for a view. More...
 
 elgg_view_exists ($view, $viewtype= '', $recurse=true)
 Returns whether the specified view exists. More...
 
 elgg_view ($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
 Return a parsed view. More...
 
 elgg_view_deprecated ($view, array $vars, $suggestion, $version)
 Display a view with a deprecation notice. More...
 
 elgg_extend_view ($view, $view_extension, $priority=501, $viewtype= '')
 Extends a view with another view. More...
 
 elgg_unextend_view ($view, $view_extension)
 Unextends a view. More...
 
 elgg_view_page ($title, $body, $page_shell= 'default', $vars=array())
 Assembles and outputs a full page. More...
 
 _elgg_views_prepare_head ($title)
 Prepare the variables for the html head. More...
 
 elgg_view_layout ($layout_name, $vars=array())
 Displays a layout with optional parameters. More...
 
 elgg_view_menu ($menu_name, array $vars=array())
 Render a menu. More...
 
 elgg_view_menu_item (ElggMenuItem $item, array $vars=array())
 Render a menu item (usually as a link) More...
 
 elgg_view_entity (ElggEntity $entity, $vars=array(), $bypass=false, $debug=false)
 Returns a string of a rendered entity. More...
 
 elgg_view_entity_icon (ElggEntity $entity, $size= 'medium', $vars=array())
 View the icon of an entity. More...
 
 elgg_view_annotation (ElggAnnotation $annotation, array $vars=array(), $bypass=false, $debug=false)
 Returns a string of a rendered annotation. More...
 
 elgg_view_entity_list ($entities, $vars=array(), $offset=0, $limit=10, $full_view=true, $list_type_toggle=true, $pagination=true)
 Returns a rendered list of entities with pagination. More...
 
 elgg_view_annotation_list ($annotations, array $vars=array())
 Returns a rendered list of annotations, plus pagination. More...
 
 elgg_view_entity_annotations (ElggEntity $entity, $full_view=true)
 Display a plugin-specified rendered list of annotations for an entity. More...
 
 elgg_view_title ($title, $vars=array())
 Renders a title. More...
 
 elgg_view_friendly_time ($time)
 Displays a UNIX timestamp in a friendly way. More...
 
 elgg_view_comments ($entity, $add_comment=true, array $vars=array())
 Returns rendered comments and a comment form for an entity. More...
 
 elgg_view_image_block ($image, $body, $vars=array())
 Wrapper function for the image block display pattern. More...
 
 elgg_view_module ($type, $title, $body, array $vars=array())
 Wrapper function for the module display pattern. More...
 
 elgg_view_river_item ($item, array $vars=array())
 Renders a human-readable representation of a river item. More...
 
 elgg_view_form ($action, $form_vars=array(), $body_vars=array())
 
 elgg_view_tagcloud (array $options=array())
 Create a tagcloud for viewing. More...
 
 elgg_view_list_item ($item, array $vars=array())
 View an item in a list. More...
 
 elgg_view_icon ($name, $class= '')
 View one of the elgg sprite icons. More...
 
 elgg_view_access_collections ($owner_guid)
 Displays a user's access collections, using the core/friends/collections view. More...
 
 set_template_handler ($function_name)
 Registers a function to handle templates. More...
 
 autoregister_views ($view_base, $folder, $base_location_path, $viewtype)
 Auto-registers views from a location. More...
 
 _elgg_views_minify ($hook, $type, $content, $params)
 Minifies simplecache CSS and JS views by handling the "simplecache:generate" hook. More...
 
 _elgg_views_amd ($hook, $type, $content, $params)
 Inserts module names into anonymous modules by handling the "simplecache:generate" hook. More...
 
 elgg_views_add_rss_link ()
 Add the rss link to the extras when if needed. More...
 
 _elgg_views_send_header_x_frame_options ()
 Sends X-Frame-Options header on page requests. More...
 
 elgg_views_handle_deprecated_views ()
 Registers deprecated views to avoid making some pages from older plugins completely empty. More...
 
 elgg_views_boot ()
 Initialize viewtypes on system boot event This ensures simplecache is cleared during upgrades. More...
 

Variables

global $CURRENT_SYSTEM_VIEWTYPE = ""
 Elgg's view system. More...
 

Function Documentation

_elgg_is_valid_viewtype (   $viewtype)

Checks if $viewtype is a string suitable for use as a viewtype name.

Parameters
string$viewtypePotential viewtype name. Alphanumeric chars plus _ allowed.
Returns
bool private
Since
1.9
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 158 of file views.php.

_elgg_is_view_cacheable (   $view)

Check whether a view is registered as cacheable.

Parameters
string$viewThe name of the view.
Returns
boolean private
Since
1.9.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 253 of file views.php.

_elgg_views_amd (   $hook,
  $type,
  $content,
  $params 
)

Inserts module names into anonymous modules by handling the "simplecache:generate" hook.

Parameters
string$hookThe name of the hook
string$typeView type (css, js, or unknown)
string$contentContent of the view
array$paramsArray of parameters
Returns
string|null View content minified (if css/js type) private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1507 of file views.php.

_elgg_views_minify (   $hook,
  $type,
  $content,
  $params 
)

Minifies simplecache CSS and JS views by handling the "simplecache:generate" hook.

Parameters
string$hookThe name of the hook
string$typeView type (css, js, or unknown)
string$contentContent of the view
array$paramsArray of parameters
Returns
string|null View content minified (if css/js type) private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1470 of file views.php.

_elgg_views_prepare_head (   $title)

Prepare the variables for the html head.

Parameters
string$titlePage title for <head>
Returns
array private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 489 of file views.php.

_elgg_views_send_header_x_frame_options ( )

Sends X-Frame-Options header on page requests.

private

Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1543 of file views.php.

autoregister_views (   $view_base,
  $folder,
  $base_location_path,
  $viewtype 
)

Auto-registers views from a location.

Note
Views in plugin/views/ are automatically registered for active plugins. Plugin authors would only need to call this if optionally including an entire views structure.
Parameters
string$view_baseOptional The base of the view name without the view type.
string$folderRequired The folder to begin looking in
string$base_location_pathThe base views directory to use with elgg_set_view_location()
string$viewtypeThe type of view we're looking at (default, rss, etc)
Returns
bool returns false if folder can't be read
Since
1.7.0
See also
elgg_set_view_location() private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1455 of file views.php.

elgg_does_viewtype_fallback (   $viewtype)

Checks if a viewtype falls back to default.

Parameters
string$viewtypeViewtype
Returns
boolean
Since
1.7.2
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 193 of file views.php.

elgg_extend_view (   $view,
  $view_extension,
  $priority = 501,
  $viewtype = '' 
)

Extends a view with another view.

The output of any view can be prepended or appended to any other view.

The default action is to append a view. If the priority is less than 500, the output of the extended view will be appended to the original view.

Views can be extended multiple times, and extensions are not checked for uniqueness. Use elgg_unextend_view() to help manage duplicates.

Priority can be specified and affects the order in which extensions are appended or prepended.

Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 401 of file views.php.

elgg_get_view_location (   $view,
  $viewtype = '' 
)

Returns the file location for a view.

Warning
This doesn't check if the file exists, but only constructs (or extracts) the path and returns it.
Parameters
string$viewThe view.
string$viewtypeThe viewtype
Returns
string
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 283 of file views.php.

elgg_get_viewtype ( )

Return the current view type.

Viewtypes are automatically detected and can be set with $_REQUEST['view'] or elgg_set_viewtype().

Examples:
/root/Elgg/engine/lib/cache.php, and /root/Elgg/engine/lib/views.php.

Definition at line 91 of file views.php.

elgg_is_registered_viewtype (   $viewtype)

Checks if $viewtype is registered.

Parameters
string$viewtypeThe viewtype name
Returns
bool
Since
1.9.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 138 of file views.php.

elgg_register_ajax_view (   $view)

Register a view to be available for ajax calls.

Warning
Only views that begin with 'js/' and 'css/' have their content type set to 'text/javascript' and 'text/css'. Other views are served as 'text/html'.
Parameters
string$viewThe view name
Returns
void
Since
1.8.3
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 208 of file views.php.

elgg_register_external_view (   $view,
  $cacheable = false 
)

Registers a view as being available externally (i.e.

via URL).

Parameters
string$viewThe name of the view.
boolean$cacheableWhether this view can be cached.
Returns
void
Since
1.9.0
Examples:
/root/Elgg/engine/lib/cache.php, and /root/Elgg/engine/lib/views.php.

Definition at line 231 of file views.php.

elgg_register_viewtype (   $viewtype)

Register a viewtype.

Parameters
string$viewtypeThe view type to register
Returns
bool
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 116 of file views.php.

elgg_register_viewtype_fallback (   $viewtype)

Register a viewtype to fall back to a default view if a view isn't found for that viewtype.

This is useful for alternate html viewtypes (such as for mobile devices).

Parameters
string$viewtypeThe viewtype to register
Returns
void
Since
1.7.2
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 181 of file views.php.

elgg_set_view_location (   $view,
  $location,
  $viewtype = '' 
)

Set an alternative base location for a view.

Views are expected to be in plugin_name/views/. This function can be used to change that location.

Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 303 of file views.php.

elgg_set_viewtype (   $viewtype = "")

Manually set the viewtype.

View types are detected automatically. This function allows you to force subsequent views to use a different viewtype.

Call elgg_set_viewtype() with no parameter to reset.

Parameters
string$viewtypeThe view type, e.g. 'rss', or 'default'.
Returns
bool
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 70 of file views.php.

elgg_unextend_view (   $view,
  $view_extension 
)

Unextends a view.

Parameters
string$viewThe view that was extended.
string$view_extensionThis view that was added to $view
Returns
bool
Since
1.7.2
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 414 of file views.php.

elgg_unregister_ajax_view (   $view)

Unregister a view for ajax calls.

Parameters
string$viewThe view name
Returns
void
Since
1.8.3
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 219 of file views.php.

elgg_unregister_external_view (   $view)

Unregister a view for ajax calls.

Parameters
string$viewThe view name
Returns
void
Since
1.9.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 264 of file views.php.

elgg_view (   $view,
  $vars = array(),
  $bypass = false,
  $ignored = false,
  $viewtype = '' 
)

Return a parsed view.

Views are rendered by a template handler and returned as strings.

Views are called with a special $vars variable set, which includes any variables passed as the second parameter. For backward compatbility, the following variables are also set but we recommend that you do not use them:

Custom template handlers can be set with set_template_handler().

The output of views can be intercepted by registering for the view, $view_name plugin hook.

Warning
Any variables in $_SESSION will override passed vars upon name collision. See https://github.com/Elgg/Elgg/issues/2124
Parameters
string$viewThe name and location of the view to use
array$varsVariables to pass to the view.
boolean$bypassIf set to true, elgg_view will bypass any specified alternative template handler; by default, it will hand off to this if requested (see set_template_handler)
boolean$ignoredThis argument is ignored and will be removed eventually
string$viewtypeIf set, forces the viewtype for the elgg_view call to be this value (default: standard detection)
Returns
string The parsed view
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 354 of file views.php.

elgg_view_access_collections (   $owner_guid)

Displays a user's access collections, using the core/friends/collections view.

Parameters
int$owner_guidThe GUID of the owning user
Returns
string A formatted rendition of the collections
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1390 of file views.php.

elgg_view_annotation ( ElggAnnotation  $annotation,
array  $vars = array(),
  $bypass = false,
  $debug = false 
)

Returns a string of a rendered annotation.

Annotation views are expected to be in annotation/$annotation_name. If a view is not found for $annotation_name, the default annotation/default will be used.

Warning
annotation/default is not currently defined in core.

The annotation view is called with the following in $vars:

  • ElggEntity 'annotation' The annotation being viewed.
Parameters
ElggAnnotation$annotationThe annotation to display
array$varsVariable array for view.
bool$bypassIf true, will not pass to a custom template handler. set_template_handler()
bool$debugComplain if views are missing
Returns
string/false Rendered annotation
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 913 of file views.php.

elgg_view_annotation_list (   $annotations,
array  $vars = array() 
)

Returns a rendered list of annotations, plus pagination.

This function should be called by wrapper functions.

Parameters
array$annotationsArray of annotations
array$varsDisplay variables 'count' The total number of annotations across all pages 'offset' The current indexing offset 'limit' The number of annotations to display per page 'full_view' Display the full view of the annotation? 'list_class' CSS Class applied to the list 'offset_key' The url parameter key used for offset 'no_results' Message to display if no results
Returns
string The list of annotations private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1044 of file views.php.

elgg_view_comments (   $entity,
  $add_comment = true,
array  $vars = array() 
)

Returns rendered comments and a comment form for an entity.

Plugins can override the output by registering a handler for the comments, $entity_type hook. The handler is responsible for formatting the comments and the add comment form.

Parameters
ElggEntity$entityThe entity to view comments of
bool$add_commentInclude a form to add comments?
array$varsVariables to pass to comment view
Returns
string|false Rendered comments or false on failure
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1144 of file views.php.

elgg_view_deprecated (   $view,
array  $vars,
  $suggestion,
  $version 
)

Display a view with a deprecation notice.

No missing view NOTICE is logged

See also
elgg_view()
Parameters
string$viewThe name and location of the view to use
array$varsVariables to pass to the view
string$suggestionSuggestion with the deprecation message
string$versionHuman-readable release version: 1.7, 1.8, ...
Returns
string The parsed view private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 371 of file views.php.

elgg_view_entity ( ElggEntity  $entity,
  $vars = array(),
  $bypass = false,
  $debug = false 
)

Returns a string of a rendered entity.

Entity views are either determined by setting the view property on the entity or by having a view named after the entity $type/$subtype. Entities that have neither a view property nor a defined $type/$subtype view will fall back to using the $type/default view.

The entity view is called with the following in $vars:

Other common view $vars paramters:

  • bool 'full_view' Whether to show a full or condensed view. (Default: true)

This function can automatically appends annotations to entities if in full view and a handler is registered for the entity:annotate. See https://github.com/Elgg/Elgg/issues/964 and elgg_view_entity_annotations().

Parameters
ElggEntity$entityThe entity to display
array$varsArray of variables to pass to the entity view. In Elgg 1.7 and earlier it was the boolean $full_view
boolean$bypassIf true, will not pass to a custom template handler. set_template_handler()
boolean$debugComplain if views are missing
Returns
string HTML to display or false
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 790 of file views.php.

elgg_view_entity_annotations ( ElggEntity  $entity,
  $full_view = true 
)

Display a plugin-specified rendered list of annotations for an entity.

This displays the output of functions registered to the entity:annotation, $entity_type plugin hook.

This is called automatically by the framework from elgg_view_entity()

Parameters
ElggEntity$entityEntity
bool$full_viewDisplay full view?
Returns
mixed string or false on failure
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1078 of file views.php.

elgg_view_entity_icon ( ElggEntity  $entity,
  $size = 'medium',
  $vars = array() 
)

View the icon of an entity.

Entity views are determined by having a view named after the entity $type/$subtype. Entities that do not have a defined icon/$type/$subtype view will fall back to using the icon/$type/default view.

Parameters
ElggEntity$entityThe entity to display
string$sizeThe size: tiny, small, medium, large
array$varsAn array of variables to pass to the view. Some possible variables are img_class and link_class. See the specific icon view for more parameters.
Returns
string HTML to display or false
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 862 of file views.php.

elgg_view_entity_list (   $entities,
  $vars = array(),
  $offset = 0,
  $limit = 10,
  $full_view = true,
  $list_type_toggle = true,
  $pagination = true 
)

Returns a rendered list of entities with pagination.

This function should be called by wrapper functions.

See also
elgg_list_entities()
list_user_friends_objects()
elgg_list_entities_from_metadata()
elgg_list_entities_from_relationships()
elgg_list_entities_from_annotations()
Parameters
array$entitiesArray of entities
array$varsDisplay variables 'count' The total number of entities across all pages 'offset' The current indexing offset 'limit' The number of entities to display per page 'full_view' Display the full view of the entities? 'list_class' CSS class applied to the list 'item_class' CSS class applied to the list items 'pagination' Display pagination? 'list_type' List type: 'list' (default), 'gallery' 'list_type_toggle' Display the list type toggle? 'no_results' Message to display if no results
Returns
string The rendered list of entities private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 969 of file views.php.

elgg_view_exists (   $view,
  $viewtype = '',
  $recurse = true 
)

Returns whether the specified view exists.

Note
If $recurse is true, also checks if a view exists only as an extension.
Parameters
string$viewThe view name
string$viewtypeIf set, forces the viewtype
bool$recurseIf false, do not check extensions
Returns
bool
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 318 of file views.php.

elgg_view_form (   $action,
  $form_vars = array(),
  $body_vars = array() 
)
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1280 of file views.php.

elgg_view_friendly_time (   $time)

Displays a UNIX timestamp in a friendly way.

See also
elgg_get_friendly_time()
Parameters
int$timeA UNIX epoch timestamp
Returns
string The friendly time HTML
Since
1.7.2
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1126 of file views.php.

elgg_view_icon (   $name,
  $class = '' 
)

View one of the elgg sprite icons.

Shorthand for

Parameters
string$nameThe specific icon to display
string$classAdditional class: float, float-alt, or custom class
Returns
string The html for displaying an icon
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1370 of file views.php.

elgg_view_image_block (   $image,
  $body,
  $vars = array() 
)

Wrapper function for the image block display pattern.

Fixed width media on the side (image, icon, flash, etc.). Descriptive content filling the rest of the column.

This is a shortcut for { page/components/image_block}.

Parameters
string$imageThe icon and other information
string$bodyDescription content
array$varsAdditional parameters for the view
Returns
string
Since
1.8.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1176 of file views.php.

elgg_view_layout (   $layout_name,
  $vars = array() 
)

Displays a layout with optional parameters.

Layouts provide consistent organization of pages and other blocks of content. There are a few default layouts in core:

  • admin A special layout for the admin area.
  • one_column A single content column.
  • one_sidebar A content column with sidebar.
  • two_sidebar A content column with two sidebars.
  • widgets A widget canvas.

The layout views take the form page/layouts/$layout_name See the individual layouts for what options are supported. The three most common layouts have these parameters: one_column content => string one_sidebar content => string sidebar => string (optional) content content => string sidebar => string (optional) buttons => string (override the default add button) title => string (override the default title) filter_context => string (selected content filter) See the content layout view for more parameters

Parameters
string$layout_nameThe name of the view in page/layouts/.
array$varsAssociative array of parameters for the layout view
Returns
string The layout
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 617 of file views.php.

elgg_view_list_item (   $item,
array  $vars = array() 
)

View an item in a list.

Parameters
ElggEntity | ElggAnnotation$item
array$varsAdditional parameters for the rendering
Returns
string
Since
1.8.0 private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1345 of file views.php.

elgg_view_menu (   $menu_name,
array  $vars = array() 
)

Render a menu.

See also
elgg_register_menu_item() for documentation on adding menu items and navigation.php for information on the different menus available.

This function triggers a 'register', 'menu:<menu name>="">' plugin hook that enables plugins to add menu items just before a menu is rendered. This is used by dynamic menus (menus that change based on some input such as the user hover menu). Using elgg_register_menu_item() in response to the hook can cause incorrect links to show up. See the blog plugin's blog_owner_block_menu() for an example of using this plugin hook.

An additional hook is the 'prepare', 'menu:<menu name>="">' which enables plugins to modify the structure of the menu (sort it, remove items, set variables on the menu items).

elgg_view_menu() uses views in navigation/menu

Parameters
string$menu_nameThe name of the menu
array$varsAn associative array of display options for the menu. Options include: sort_by => string or php callback string options: 'name', 'priority', 'title' (default), 'register' (registration order) or a php callback (a compare function for usort) handler: string the page handler to build action URLs entity: ElggEntity to use to build action URLs class: string the class for the entire menu. show_section_headers: bool show headers before menu sections.
Returns
string
Since
1.8.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 687 of file views.php.

elgg_view_menu_item ( ElggMenuItem  $item,
array  $vars = array() 
)

Render a menu item (usually as a link)

Parameters
ElggMenuItem$itemThe menu item
array$varsOptions to pass to output/url if a link
Returns
string
Since
1.9.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 726 of file views.php.

elgg_view_module (   $type,
  $title,
  $body,
array  $vars = array() 
)

Wrapper function for the module display pattern.

Box with header, body, footer

This is a shortcut for { page/components/module}.

Parameters
string$typeThe type of module (main, info, popup, aside, etc.)
string$titleA title to put in the header
string$bodyContent of the module
array$varsAdditional parameters for the module
Returns
string
Since
1.8.0
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1197 of file views.php.

elgg_view_page (   $title,
  $body,
  $page_shell = 'default',
  $vars = array() 
)

Assembles and outputs a full page.

A "page" in Elgg is determined by the current view type and can be HTML for a browser, RSS for a feed reader, or Javascript, PHP and a number of other formats.

For HTML pages, use the 'head', 'page' plugin hook for setting meta elements and links.

Parameters
string$titleTitle
string$bodyBody
string$page_shellOptional page shell to use. See page/shells view directory
array$varsOptional vars array to pass to the page shell. Automatically adds title, body, head, and sysmessages
Returns
string The contents of the page
Since
1.8
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 437 of file views.php.

elgg_view_river_item (   $item,
array  $vars = array() 
)

Renders a human-readable representation of a river item.

Parameters
ElggRiverItem$itemA river item object
array$varsAn array of variables for the view
Returns
string returns empty string if could not be rendered
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1213 of file views.php.

elgg_view_tagcloud ( array  $options = array())

Create a tagcloud for viewing.

See also
elgg_get_tags
Parameters
array$optionsAny elgg_get_tags() options except:
type => must be single entity type

subtype => must be single entity subtype
Returns
string
Since
1.7.1
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1317 of file views.php.

elgg_view_title (   $title,
  $vars = array() 
)

Renders a title.

This is a shortcut for { page/elements/title}.

Parameters
string$titleThe page title
array$varsView variables (was submenu be displayed? (deprecated))
Returns
string The HTML (etc)
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1105 of file views.php.

elgg_views_add_rss_link ( )

Add the rss link to the extras when if needed.

Returns
void private
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1518 of file views.php.

elgg_views_boot ( )

Initialize viewtypes on system boot event This ensures simplecache is cleared during upgrades.

See #2252

Returns
void private boot system
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1568 of file views.php.

elgg_views_handle_deprecated_views ( )

Registers deprecated views to avoid making some pages from older plugins completely empty.

private

Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1553 of file views.php.

set_template_handler (   $function_name)

Registers a function to handle templates.

Alternative template handlers can be registered to handle all output functions. By default, elgg_view() will simply include the view file. If an alternate template handler is registered, the view name and passed $vars will be passed to the registered function, which is then responsible for generating and returning output.

Template handlers need to accept two arguments: string $view_name and array $vars.

Warning
This is experimental.
Parameters
string$function_nameThe name of the function to pass to.
Returns
bool
See also
elgg_view()
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 1428 of file views.php.

Variable Documentation

$CURRENT_SYSTEM_VIEWTYPE = ""

Elgg's view system.

The view system is the primary templating engine in Elgg and renders all output. Views are short, parameterised PHP scripts for displaying output that can be regsitered, overridden, or extended. The view type determines the output format and location of the files that renders the view.

Elgg uses a two step process to render full output: first content-specific elements are rendered, then the resulting content is inserted into a layout and displayed. This makes it easy to maintain a consistent look on all pages.

A view corresponds to a single file on the filesystem and the views name is its directory structure. A file in mod/plugins/views/default/myplugin/example.php is called by saying (with the default viewtype): echo elgg_view('myplugin/example');

View names that are registered later override those that are registered earlier. For plugins this corresponds directly to their load order: views in plugins lower in the list override those higher in the list.

Plugin views belong in the views/ directory under an appropriate viewtype. Views are automatically registered.

Views can be embedded-you can call a view from within a view. Views can also be prepended or extended by any other view.

Any view can extend any other view if registered with elgg_extend_view().

Viewtypes are set by passing $_REQUEST['view']. The viewtype 'default' is a standard HTML view. Types can be defined on the fly and you can get the current viewtype with elgg_get_viewtype(). The viewtype override.

string $CURRENT_SYSTEM_VIEWTYPE

See also
elgg_set_viewtype()
Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 55 of file views.php.