Contenido API - Article Object

This object represents a Contenido article

Create object with $obj = new Article(idart, client, lang [, idartlang]);

You can now read the article properties with $obj->getField(property);

List of article properties:

idartlang - Language dependant article id idart - Language indepenant article id idclient - Id of the client idtplcfg - Template configuration id title - Internal Title pagetitle - HTML Title summary - Article summary created - Date created lastmodified - Date lastmodiefied author - Article author (username) online - On-/offline redirect - Redirect redirect_url - Redirect URL artsort - Article sort key timemgmt - Time management datestart - Time management start date dateend - Time management end date status - Article status free_use_01 - Free to use free_use_02 - Free to use free_use_03 - Free to use time_move_cat - Move category after time management time_target_cat - Move category to this cat after time management time_online_move - Set article online after move external_redirect - Open article in new window locked - Article is locked for editing

You can extract article content with the $obj->getContent(contype [, number]) method.

To extract the first headline you can use:

$headline = $obj->getContent("htmlhead", 1);

If the second parameter is ommitted the method returns an array with all available content of this type. The array has the following schema:

array( number => content );

$headlines = $obj->getContent("htmlhead");

$headlines[1] First headline $headlines[2] Second headline $headlines[6] Sixth headline

Legal content type string are defined in the Contenido system table 'con_type'. Default content types are:

NOTE: This parameter is case insesitive, you can use html or cms_HTML or CmS_HtMl. Your don't need start with cms, but it won't crash if you do so.

htmlhead - HTML Headline html - HTML Text headline - Headline (no HTML) text - Text (no HTML) img - Upload id of the element imgdescr - Image description link - Link (URL) linktarget - Linktarget (_self, _blank, _top ...) linkdescr - Linkdescription swf - Upload id of the element

author Timo A. Hummel <Timo.Hummel@4fb.de>
version 0.1
copyright four for business 2003

 Methods

Constructor

Article(int $idart, $client, int $lang, $idartlang) : void

Parameters

$idart

int

Article Id

$client

$lang

int

Language Id

$idartlang

Constructor Function

Item(string $table, string $primaryKey, $lifetime) 
Inherited
inherited_from \Item::Item()

Parameters

$table

string

The table to use as information source

$primaryKey

string

The primary key to use

$lifetime

Load the articles content and stores it in the 'content' property of the article object

_getArticleContent() : void

$article->content[type][number] = value;

Extract 'idartlang' for a specified 'idart' and 'lang'

_getIdArtLang(int $idart, int $lang) : int
access private

Parameters

$idart

int

Article id

$lang

int

Language id

Returns

intLanguage dependant article id

Filters the passed data using the functions defines in the _arrInFilters array.

_inFilter(mixed $data) : mixed
Inherited
see \setFilters
access private
inherited_from \Item::_inFilter()

Parameters

$data

mixed

Data to filter

Returns

mixedFiltered data

_onLoad ()

_onLoad() : \none
Inherited

Function which is called whenever an item is loaded. Inherited classes should override this function if desired.

inherited_from \Item::_onLoad()

Returns

\none

Filters the passed data using the functions defines in the _arrOutFilters array.

_outFilter(mixed $data) : mixed
Inherited
see \setFilters
access private
inherited_from \Item::_outFilter()

Parameters

$data

mixed

Data to filter

Returns

mixedFiltered data

_setMetaObject()

_setMetaObject($objectname) 
Inherited
inherited_from \Item::_setMetaObject()

Parameters

$objectname

deleteProperty ($type, $name) Deletes a custom property

deleteProperty(string $type, string $name) 
Inherited
inherited_from \Item::deleteProperty()

Parameters

$type

string

Specifies the type

$name

string

Specifies the name

get($field) Wrapper for getField (less to type)

get(string $field) : mixed
Inherited
inherited_from \Item::get()

Parameters

$field

string

Specifies the field to retrieve

Returns

mixedValue of the field

Get content(s) from an article

getContent(string $type, int $id) : mixed

Returns the specified content element or an array("id"=>"value") if the second parameter is omitted.

Legal content type string are defined in the Contenido system table 'con_type'. Default content types are:

NOTE: Parameter is case insesitive, you can use html or cms_HTML or CmS_HtMl. Your don't need start with cms, but it won't crash if you do so.

htmlhead - HTML Headline html - HTML Text headline - Headline (no HTML) text - Text (no HTML) img - Upload id of the element imgdescr - Image description link - Link (URL) linktarget - Linktarget (_self, _blank, _top ...) linkdescr - Linkdescription swf - Upload id of the element

Parameters

$type

string

CMS_TYPE - Legal cms type string

$id

int

Id of the content

Returns

mixedString/Array Content Data

Get the value of an article property

getField(string $name) : mixed

List of article properties:

idartlang - Language dependant article id idart - Language indepenant article id idclient - Id of the client idtplcfg - Template configuration id title - Internal Title pagetitle - HTML Title summary - Article summary created - Date created lastmodified - Date lastmodiefied author - Article author (username) online - On-/offline redirect - Redirect redirect_url - Redirect URL artsort - Article sort key timemgmt - Time management datestart - Time management start date dateend - Time management end date status - Article status free_use_01 - Free to use free_use_02 - Free to use free_use_03 - Free to use time_move_cat - Move category after time management time_target_cat - Move category to this cat after time management time_online_move - Set article online after move external_redirect - Open article in new window locked - Article is locked for editing

Parameters

$name

string

Property name

Returns

mixedProperty value

getMetaObject()

getMetaObject() 
Inherited
inherited_from \Item::getMetaObject()

getProperty ($type, $name) Sets a custom property

getProperty(string $type, string $name) : boolean
Inherited
inherited_from \Item::getProperty()

Parameters

$type

string

Specifies the type

$name

string

Specifies the name

Returns

booleanValue of the given property

loadBy ($field, $value) Loads an item by colum/field from the database

loadBy(string $field, string $value, bool $bSafe) : bool
Inherited
inherited_from \Item::loadBy()

Parameters

$field

string

Specifies the field

$value

string

Specifies the value

$bSafe

bool

use inFilter or not

Returns

boolTrue if the load was successful

loadByPrimaryKey ($value) Loads an item by ID from the database

loadByPrimaryKey(string $value) : bool
Inherited
inherited_from \Item::loadByPrimaryKey()

Parameters

$value

string

Specifies the primary key value

Returns

boolTrue if the load was successful

set($field, $value) Shortcut to setField

set(string $field, string $value, $safe) 
Inherited
inherited_from \Item::set()

Parameters

$field

string

Specifies the field to set

$value

string

Specifies the value to set

$safe

setField($field, $value) Sets the value of a specific field

setField(string $field, string $value, boolean $safe) 
Inherited
inherited_from \Item::setField()

Parameters

$field

string

Specifies the field to set

$value

string

Specifies the value to set

$safe

boolean

Speficies if we should translate characters

Define the filter functions used when data is being stored or retrieved from the database.

setFilters(array $arrInFilters, array $arrOutFilters) : void
Inherited

Examples:

$obj->setFilters(array('addslashes'), array('stripslashes')); $obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));

inherited_from \Item::setFilters()

Parameters

$arrInFilters

array

inFilters array with function names

$arrOutFilters

array

outFilters array with function names

setProperty ($type, $name, $value) Sets a custom property

setProperty(string $type, string $name, string $value) 
Inherited
inherited_from \Item::setProperty()

Parameters

$type

string

Specifies the type

$name

string

Specifies the name

$value

string

Specifies the value

Store -DISABLED-

store() : \none

This Article Object is READ ONLY

access private

Returns

\none

 Properties

 

$_arrInFilters : array
Inherited
access private
inherited_from \Item::$$_arrInFilters
 

$_arrOutFilters : array
Inherited
access private
inherited_from \Item::$$_arrOutFilters
 

$_metaObject 
Inherited
inherited_from \Item::$$_metaObject
 

$cache : array
Inherited
access private
inherited_from \Item::$$cache
 

$content : array
 

$db : object
Inherited
access private
inherited_from \Item::$$db
 

$lasterror : string
Inherited
access private
inherited_from \Item::$$lasterror
 

Lifetime in seconds

$lifetime : int
Inherited
access private
inherited_from \Item::$$lifetime
 

$modifiedValues : array
Inherited
access private
inherited_from \Item::$$modifiedValues
 

$oldPrimaryKey : string
Inherited
access private
inherited_from \Item::$$oldPrimaryKey
 

$primaryKey : object
Inherited
access private
inherited_from \Item::$$primaryKey
 

PropertyCollection object

$properties : object
Inherited
access private
inherited_from \Item::$$properties
 

$tab : array
 

$table : string
Inherited
access private
inherited_from \Item::$$table
 

$values : array
Inherited
access private
inherited_from \Item::$$values
 

$virgin : boolean
Inherited

If true, the object is virgin and no operations on it except load-Functions are allowed.

access private
inherited_from \Item::$$virgin