Class: Template
Source Location: /qp_inc/templates/model/_template.class.php
Class Template
Inherited Properties, Constants, and Methods
Property Summary
| array |
$_trans |
The translations keyed by locale. They get loaded through include() of _global.php. |
Method Summary
| static
void
|
disp_screenshot() |
Display screenshot for template folder in various places. |
| boolean |
dbinsert() |
Insert object into DB based on previously recorded changes. |
| boolean |
dbupdate() |
Update the DB based on previously recorded changes |
| void |
get_name() |
Get the customized name for the template. |
| void |
get_setting() |
Get a template specific param value from current Blog |
| boolean |
install() |
Install current template to DB |
| void |
set_setting() |
Set a template specific param value for current Blog |
| string |
TS_() |
Translate and escape single quotes. |
| string |
T_() |
Translate a given string, in the Template's context. |
Properties
Our own application credits (lazy filled by constructor).
These are displayed by the "credits" display handler.
The translations keyed by locale. They get loaded through include() of _global.php.
API Tags:
Methods
static void disp_screenshot(
$template_folder,
$template_name, [
$function = NULL], [
$selected = false], [
$select_url = NULL], [
$function_url = NULL]
)
|
|
Display screenshot for template folder in various places.
Including for NON installed templates.
Parameters:
|
|
$template_folder: |
|
|
|
$template_name: |
|
|
|
$function: |
|
|
|
$selected: |
|
|
|
$select_url: |
|
|
|
$function_url: |
|
Template Template(
[table
$db_row = NULL], [
$template_folder = NULL]
)
|
|
Constructor
Parameters:
|
table |
$db_row: |
Database row |
|
|
$template_folder: |
|
void container(
string
$sco_name, [array
$params = array()]
)
|
|
Display a container
$params = array_merge( array( // stop annoying validation errors when container is <ul> and empty
'container_start' => '<div id="%sco_name%" class="container">',
'container_end' => '</div>',
), $params );
Parameters:
|
string |
$sco_name: |
|
|
array |
$params: |
|
API Tags:
void CreateDefaultWidgets(
obj
&$edited_Blog
)
|
|
Create default widgets for requested blog
Parameters:
|
obj |
&$edited_Blog: |
Blog $edited_Blog |
Information Tags:
| Todo: | yabs > change this to param array |
Insert object into DB based on previously recorded changes.
API Tags:
Redefinition of:
- DataObject::dbinsert()
- Insert object into DB based on previously recorded changes.
Update the DB based on previously recorded changes
API Tags:
Redefinition of:
- DataObject::dbupdate()
- Update the DB based on previously recorded changes
void dbupdate_settings(
)
|
|
Save template specific settings for current blgo to DB
void db_save_containers(
)
|
|
Save containers
to be called by dbinsert / dbupdate
void discover_containers(
)
|
|
Discover containers included in template file
Get ready for displaying the template.
This may register some CSS or JS...
Redefined in descendants as:
Get default name for the template.
Note: the admin can customize it.
Redefined in descendants as:
-
asevo_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
basic_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
custom_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
evocamp_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
evopress_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
glossyblue_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
intense_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
miami_blue_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
natural_pink_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
nifty_corners_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
photoblog_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
pixelgreen_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
pluralism_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
terrafirma_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
vastitude_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
_atom_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
_rdf_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
_rss_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
_rss2_Template::get_default_name()
: Get default name for the template, which the admin can customize.
-
_sitemap_Template::get_default_name()
: Get default name for the template, which the admin can customize.
Get default type for the template.
Redefined in descendants as:
array get_default_widgets(
[
$params = array()]
)
|
|
Get default widgets for new blog
The new blog's template can suggest/select a list of widgets. If it does not a default list is used. A template can suggest/select any widget by identifying the container, and each widget's code and type. The code can be 'widget' or 'plugin'. If 'plugin' and the plugin is not installed nothing bad happens. I think. $default_widgets = array(
'Header' => array(),
'Menu' => array(),
'Sidebar' => array(),
);
$default_widgets['Header'][] = array(
'title' => array(
'type' => 'widget',
),
);
$default_widgets['Menu'][] = array(
'menu_link' => array(
'type' => 'widget',
'params' => array(
'link_type'=>'ownercontact',
),
),
);
$default_widgets['Sidebar'][] = array(
'calendar' => array(
'type' => 'plugin',
),
);
A widget installed with only code and type will have default values for any parameters it may have.
Parameters:
API Tags:
| Return: | widgets for each container |
Information Tags:
| Todo: | (EdB/7618): verify/ensure each widget needs to identify it's own param possibilities |
Redefined in descendants as:
Get the customized name for the template.
void get_param_definitions(
local
$params
)
|
|
Get definitions for editable params
Parameters:
|
local |
$params: |
params like 'for_editing' => true |
API Tags:
Information Tags:
| Todo: | this is destined to be overridden by derived Template classes |
Redefined in descendants as:
void get_setting(
$parname
)
|
|
Get a template specific param value from current Blog
Parameters:
array get_template_credits(
)
|
|
Get credits for linkback on credits page.
Each template can and should provide an array for credits for domains/authors who created the original design, inspired your design, or ported the template in the following format: $template_linkbacks = array(
'designer' => array(
'pre' => T_('Design by'),
'text' => 'linked text',
'post' => T_('A reasonably brief summary of the template. A sentence or two should be enough?'),
'url' => 'http://yourdomain.tld/',
'title' => T_('insert creative link title'),
),
);
return $template_linkbacks;
Consider "designer" or "inspired" or "ported" as usual and customary types, and please limit the amount of linkbacks provided in the array. More than 3 will give a warning to the installer that your template might be spam! 'pre' => T_('Design by') or T_('Inspired by') or T_('Ported by') 'text' => the linked text - your name or domain name for example 'post' => can be '' (empty), and can hold HTML if you want. Please keep it reasonably short! 'url' => REQUIRED (of course). Without a URL there is no linkback! 'title' => can be whatever you like, but should never be empty. Use the URL if nothing else.
API Tags:
| Return: | The credits array (see above). |
Redefined in descendants as:
Install current template to DB
API Tags:
| Return: | True on success, false on failure. |
boolean load_from_Request(
)
|
|
Load data from Request form fields.
API Tags:
| Return: | true if loaded data seems valid. |
void load_params_from_Request(
)
|
|
Load params
void set_setting(
string
$parname, mixed
$parvalue
)
|
|
Set a template specific param value for current Blog
Parameters:
|
string |
$parname: |
parameter name |
|
mixed |
$parvalue: |
parameter value |
string TS_(
string
$string, [string
$req_locale = '']
)
|
|
Translate and escape single quotes.
This is to be used mainly for Javascript strings.
Parameters:
|
string |
$string: |
String to translate |
|
string |
$req_locale: |
Locale to use |
API Tags:
Information Tags:
| Since: | 3.2.0 (after beta) |
string T_(
string
$string, [string
$req_locale = '']
)
|
|
Translate a given string, in the Template's context.
This means, that the translation is obtained from the Template's "po/php" folder. It uses the global/regular T_() function as a fallback.
Parameters:
|
string |
$string: |
The string (english), that should be translated |
|
string |
$req_locale: |
Requested locale ($current_locale gets used by default) |
API Tags:
Information Tags:
| Since: | 3.2.0 (after beta) |
|
|