Send mails based on WebLab_Template.

Joins images into the e-mail for optimal viewing.

author Jorgen Evens
package WebLab

 Methods

Generates a new Mail object.

__construct(String $template, String $to, String $subject, String $from, String $content_type) 

Parameters

$template

String

The template path

$to

String

The recipients

$subject

String

The subject of this e-mail. Defaults to 'Automated mail'

$from

String

From who the receiver gets this message. Defaults to 'admin@server'

$content_type

String

The content type to set in the headers.

Catches all the property calls to return the appropriate variable.

__get(String $name) : Object
Inherited
inherited_from \WebLab_Template::__get()

Parameters

$name

String

The name of the property (variable) te get.

Returns

ObjectThe value of this property.

Catches all the property calls to set the appropriate variable.

__set(String $name, Object $value) : \WebLab_Template
Inherited
inherited_from \WebLab_Template::__set()

Parameters

$name

String

The name of the property (variable) being set.

$value

Object

&$value The value to be set.

Returns

\WebLab_TemplateThis template instance.

Returns the value of the function render.

__toString() : String
Inherited
inherited_from \WebLab_Template::__toString()

Returns

StringReturns HTML that has been rendered by the render function. If a Exception occurs the message of this exception will be returned.

Attaches a template as a variable to this template.

attach(\WebLab_Template $template, String $moduleName) : \WebLab_Template
Inherited
inherited_from \WebLab_Template::attach()

Parameters

$template

\WebLab_Template

Template you would like to attach to this template.

$moduleName

String

Variable name for $template.

Returns

\WebLab_TemplateThis template instance.

Get a template variable.

get(string $variable) : \mixed:
Inherited
inherited_from \WebLab_Template::get()

Parameters

$variable

string

Returns

\mixed:

Get the root template for current request.

getRootTemplate() 
InheritedStatic
inherited_from \WebLab_Template::getRootTemplate()

Get the entire stack of variables currently attached to this template.

getVars() : Array
Inherited
inherited_from \WebLab_Template::getVars()

Returns

ArrayReturn an array of attached variables. VariableNames as keys.

Generates the body of the Mail.

render(bool $show) : String

Parameters

$show

bool

Output result of this function to the browser. Defaults to false.

Returns

StringThe body of the e-mail.

Transmits the e-mail to all the receivers.

send() : bool

Returns

boolIndicates whether the send operation was successful.

Set a template variable value.

set(string $variable, mixed $value) : \WebLab_Template
Inherited
inherited_from \WebLab_Template::set()

Parameters

$variable

string

$value

mixed

Returns

Set the root template for current request.

setRootTemplate(\WebLab_Template $template) 
InheritedStatic
inherited_from \WebLab_Template::setRootTemplate()

Parameters

$template

\WebLab_Template

Set the location of the template directory.

setTemplateDir(String $dir) 
Inherited

This directory contains all of the themes.

inherited_from \WebLab_Template::setTemplateDir()

Parameters

$dir

String

The directory to look for templates and themes.

Set the theme folder within the template directory.

setTheme(String $dir) : \WebLab_Template
Inherited
inherited_from \WebLab_Template::setTheme()

Parameters

$dir

String

Foldername of the theme.

Returns

\WebLab_TemplateThis template instance.

Retrieve cached template

_getCache($path) : string | NULL
Inherited
inherited_from \WebLab_Template::_getCache()

Parameters

$path

Returns

stringNULL

Lazy load config.

_getConfig() 
InheritedStatic
inherited_from \WebLab_Template::_getConfig()

Loads the init component of a template.

_init() 
Inherited

Injecting headers, scripts or styles should be done here.

inherited_from \WebLab_Template::_init()

Include a component file for current template $component will be attached behind the filename, including a suffix .php

_load(string $component, $extract) 
Inherited
inherited_from \WebLab_Template::_load()

Parameters

$component

string

$extract

Parses the code generate by the template for images.

_parseTemplate(String $html_code) : String

Parameters

$html_code

String

The HTML code to parse.

Returns

StringThe HTML code parsed to include images.

Put cached code

_putCache($path, string $code) 
Inherited
inherited_from \WebLab_Template::_putCache()

Parameters

$path

$code

string

Set some default settings for a template.

setBasicVariables() 
Inherited
inherited_from \WebLab_Template::setBasicVariables()

 Properties

 

The maximum age in seconds of a cached template.

$max_cache_age : int
Inherited
inherited_from \WebLab_Template::$$max_cache_age
 

$_boundary : String
 

Contains config for templates.

$_config : \stdClass
Inherited
inherited_from \WebLab_Template::$$_config
 

$_content_type : String
 

The directory in which to search for the templates.

$_dir : String
Inherited
inherited_from \WebLab_Template::$$_dir
 

$_from : String
 

$_root : \WebLab_Template
Inherited
inherited_from \WebLab_Template::$$_root
 

Determines if logic should be called.

$_setup : string
Inherited
inherited_from \WebLab_Template::$$_setup
 

$_subject : String
 

Contains the path to the template file.

$_template : String
Inherited
inherited_from \WebLab_Template::$$_template
 

The directory of a specific theme. Defaults to 'source'.

$_theme : String
Inherited
inherited_from \WebLab_Template::$$_theme
 

$_to : String
 

All variables assigned to this template.

$_variables : Array
Inherited
inherited_from \WebLab_Template::$$_variables