# Class Mailchimp_Templates

Located at Mailchimp/Templates.php

Methods summary
`public` | # `__construct( `Mailchimp` $master )`
`public associative_array` | # `add( string $name, string $html, integer $folder_id = null )` Create a new user template, <strong>NOT</strong> campaign content. These templates can then be applied while creating campaigns. Create a new user template, <strong>NOT</strong> campaign content. These templates can then be applied while creating campaigns. #### Parameters $name `string` $name $html `string` $html $folder_id `integer` $folder_id #### Returns `associative_array` with a single element: - template_id int the new template id, otherwise an error is thrown.
`public associative_array` | # `del( integer $template_id )` Delete (deactivate) a user template Delete (deactivate) a user template #### Parameters $template_id `integer` $template_id #### Returns `associative_array` with a single entry: - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise.
`public associative_array` | # `info( integer $template_id, string $type = 'user' )` Pull details for a specific template to help support editing Pull details for a specific template to help support editing #### Parameters $template_id `integer` $template_id $type `string` $type #### Returns `associative_array` info to be used when editing - default_content associative_array the default content broken down into the named editable sections for the template - dependant upon template, so not documented - sections associative_array the valid editable section names - dependant upon template, so not documented - source string the full source of the template as if you exported it via our template editor - preview string similar to the source, but the rendered version of the source from our popup preview
`public associative_array` | # `getList( associative_array $types = array(), associative_array $filters = array() )` Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created. Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created. #### Parameters $types `associative_array` $types - user boolean Custom templates for this user account. Defaults to true. - gallery boolean Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false. - base boolean Our "start from scratch" extremely basic templates. Defaults to false. $filters `associative_array` $filters - category string optional for Gallery templates only, limit to a specific template category - folder_id string user templates, limit to this folder_id - include_inactive boolean user templates are not deleted, only set inactive. defaults to false. - inactive_only boolean only include inactive user templates. defaults to false. #### Returns `associative_array` for each type - user array matching user templates, if requested. - id int Id of the template - name string Name of the template - layout string General description of the layout of the template - category string The category for the template, if there is one. - preview_image string If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available - date_created string The date/time the template was created - active boolean whether or not the template is active and available for use. - edit_source boolean Whether or not you are able to edit the source of a template. - folder_id boolean if it's in one, the folder id - gallery array matching gallery templates, if requested. - id int Id of the template - name string Name of the template - layout string General description of the layout of the template - category string The category for the template, if there is one. - preview_image string If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available - date_created string The date/time the template was created - active boolean whether or not the template is active and available for use. - edit_source boolean Whether or not you are able to edit the source of a template. - base array matching base templates, if requested. - id int Id of the template - name string Name of the template - layout string General description of the layout of the template - category string The category for the template, if there is one. - preview_image string If we've generated it, the url of the preview image for the template. We do out best to keep these up to date, but Preview image urls are not guaranteed to be available - active boolean whether or not the template is active and available for use. - date_created string The date/time the template was created - edit_source boolean Whether or not you are able to edit the source of a template.
`public associative_array` | # `undel( integer $template_id )` Undelete (reactivate) a user template Undelete (reactivate) a user template #### Parameters $template_id `integer` $template_id #### Returns `associative_array` with a single entry: - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise.
`public associative_array` | # `update( integer $template_id, associative_array $values )` Replace the content of a user template, <strong>NOT</strong> campaign content. Replace the content of a user template, <strong>NOT</strong> campaign content. #### Parameters $template_id `integer` $template_id $values `associative_array` $values - name string the name for the template - names must be unique and a max of 50 bytes - html string a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our template language. - folder_id int the folder to put this template in - 0 or a blank values will remove it from a folder. #### Returns `associative_array` with a single entry: - complete bool whether the call worked. reallistically this will always be true as errors will be thrown otherwise.