Retired Documentation
You are using the documentation for version 2.11.9. Go here for the latest version or check here for your available upgrades to the latest version.
ExpressionEngine Template Structure API¶
Calling the Class¶
-
class
Api_template_structure
¶ The Template Structure class is called with the
api->instantiate()
function:ee()->load->library('api'); ee()->api->instantiate('template_structure');
Function Reference¶
Get Group Info¶
-
Api_template_structure::
get_group_info
($group_id)¶ Get template group metadata:
ee()->api_template_structure->get_group_info((int) $group_id);
Parameters: - $group_id (int) – Integer of the template group
Returns: Database result object or returns
FALSE
on errorReturn type: Database result object/Boolean
Create Template Group¶
-
Api_template_structure::
create_template_group
($data[, $duplicate_group = FALSE])¶ Creates a new template group:
ee()->api_template_structure->create_template_group((array) $data, (int) $duplicate_group = FALSE)
Parameters: - $data (array) – Associative array of template group data must
include
group_name
, can include keys below - $duplicate_group (int) – The
template_group
ID to duplicate
Returns: ID of newly created group or
FALSE
on errorReturn type: Integer/Boolean
Example Usage:
$data = array( 'group_name' => 'home', 'group_order' => 2, // Defaults to template_group count + 1 'is_site_default' => 'n', // Defaults to 'n' 'site_id' => 1 // Defaults to config->item('site_id') ); ee()->api_template_structure->create_template_group($data, 1);
- $data (array) – Associative array of template group data must
include
File Extensions¶
-
Api_template_structure::
file_extensions
($template_type)¶ Returns a file extension that corresponds to the template type:
ee()->api_template_structure->file_extensions((str) $template_type);
Parameters: - $template_type (string) – Name of the template type
Returns: File extension if template type exists or an empty string
Return type: String
Template Types:
webpage
static
feed
css
js
xml