Load the articles content and stores it in the 'content' property of the article object.
loadArticleContent()
$article->content[type][number] = value;
inherited_from | \cApiArticleLanguage::loadArticleContent() |
---|
CONTENIDO API - Article Object
This object represents a CONTENIDO article
Create object with $obj = new cApiArticleLanguage(idartlang); or with $obj = new cApiArticleLanguage(); $obj->loadByArticleAndLanguageId(idart, lang);
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 searchable - Whether article should be found via search sitemapprio - The priority for the sitemap
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
deprecated | [2011-10-19] Use cApiArticleLanguage class in classes/contenido/class.articlelanguage.php as follows:
// create with article language id $obj = new cApiArticleLanguage($idartlang); // create with article id and language id $obj = new cApiArticleLanguage(); $obj->loadByArticleAndLanguageId($idart, $lang); |
---|---|
package | CONTENIDO API |
copyright | four for business AG |
Article($idart, $client, $lang, $idartlang)
Item($sTable, $sPrimaryKey, $iLifetime)
inherited_from | \Item::Item() |
---|---|
inherited_from | \cApiArticleLanguage::Item() |
__construct(int $idart, int $client, int $lang, int $idartlang) : void
Wrapper for parent class, provides thee downwards compatible interface for creation of the article object.
int
Article id
int
Client id (not used)
int
Language id
int
Article language id
\cInvalidArgumentException |
If table name or primary key is not set |
---|
_inFilter(mixed $mData) : mixed
see | \setFilters |
---|---|
inherited_from | \Item::_inFilter() |
inherited_from | \cApiArticleLanguage::_inFilter() |
mixed
Data to filter
mixed
Filtered datacApiArticleLanguage($mId)
inherited_from | \cApiArticleLanguage::cApiArticleLanguage() |
---|
deleteProperty(string $sType, string $sName) : bool
inherited_from | \Item::deleteProperty() |
---|---|
inherited_from | \cApiArticleLanguage::deleteProperty() |
string
Specifies the type
string
Specifies the name
bool
deletePropertyById(int $idprop) : bool
inherited_from | \Item::deletePropertyById() |
---|---|
inherited_from | \cApiArticleLanguage::deletePropertyById() |
int
Id of property
bool
escape(string $sString) : string
inherited_from | \cItemBaseAbstract::escape() |
---|---|
inherited_from | \Item::escape() |
inherited_from | \cApiArticleLanguage::escape() |
string
The string to escape
string
Escaped stringget(string $sField) : mixed
inherited_from | \Item::get() |
---|---|
inherited_from | \cApiArticleLanguage::get() |
string
Specifies the field to retrieve
mixed
Value of the fieldgetContent(string $type, int | null $id) : string
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
inherited_from | \cApiArticleLanguage::getContent() |
---|
string
CMS_TYPE - Legal cms type string
int
null
Id of the content
string
array datagetContentTypes() : array
inherited_from | \cApiArticleLanguage::getContentTypes() |
---|
\cException |
if no content has been loaded |
---|
array
getField(string $name) : string
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 searchable - Whether article should be found via search sitemapprio - The priority for the sitemap
inherited_from | \cApiArticleLanguage::getField() |
---|
string
string
Value of propertygetLink() : string
inherited_from | \cApiArticleLanguage::getLink() |
---|
string
linkgetMetaObject()
inherited_from | \Item::getMetaObject() |
---|---|
inherited_from | \cApiArticleLanguage::getMetaObject() |
getProperty(string $sType, string $sName) : mixed
inherited_from | \Item::getProperty() |
---|---|
inherited_from | \cApiArticleLanguage::getProperty() |
string
Specifies the type
string
Specifies the name
mixed
Value of the given property or falseisLoaded() : bool
inherited_from | \Item::isLoaded() |
---|---|
inherited_from | \cApiArticleLanguage::isLoaded() |
bool
loadArticleContent()
$article->content[type][number] = value;
inherited_from | \cApiArticleLanguage::loadArticleContent() |
---|
loadBy(string $sField, mixed $mValue, bool $bSafe) : bool
inherited_from | \Item::loadBy() |
---|---|
inherited_from | \cApiArticleLanguage::loadBy() |
string
Specifies the field
mixed
Specifies the value
bool
Use inFilter or not
\cException |
if more than one item has been found matching the given arguments |
---|
bool
True if the load was successfulloadByArticleAndLanguageId(int $idart, int $idlang, bool $fetchContent) : bool
inherited_from | \cApiArticleLanguage::loadByArticleAndLanguageId() |
---|
int
Article id
int
Language id
bool
Flag to fetch content
bool
true on success, otherwhise falseloadByMany(array $aAttributes, bool $bSafe) : bool
inherited_from | \Item::loadByMany() |
---|---|
inherited_from | \cApiArticleLanguage::loadByMany() |
array
associative array with field / value pairs
bool
Use inFilter or not
\cException |
if more than one item could be found matching the given arguments |
---|
bool
True if the load was successfulloadByPrimaryKey(string $mValue) : bool
inherited_from | \Item::loadByPrimaryKey() |
---|---|
inherited_from | \cApiArticleLanguage::loadByPrimaryKey() |
string
Specifies the primary key value
bool
True if the load was successfulloadByRecordSet(array $aRecordSet)
inherited_from | \Item::loadByRecordSet() |
---|---|
inherited_from | \cApiArticleLanguage::loadByRecordSet() |
array
The recordset of the item
register(string $event, mixed $callback, mixed $class) : void
Example: cGenericDb::register(cGenericDb::CREATE_SUCCESS, 'itemCreateHandler', 'cApiArticle'); cGenericDb::register(cGenericDb::CREATE_SUCCESS, array('cCallbackHandler', 'executeCreateHandle'), 'cApiArticle');
inherited_from | \cGenericDb::register() |
---|---|
inherited_from | \cItemBaseAbstract::register() |
inherited_from | \Item::register() |
inherited_from | \cApiArticleLanguage::register() |
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Callback to register
mixed
Class name for registering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if event or class are not set or the callback is not callable |
---|
set(string $sField, string $mValue, bool $bSafe)
inherited_from | \Item::set() |
---|---|
inherited_from | \cApiArticleLanguage::set() |
string
Field name
string
Value to set
bool
Flag to run defined inFilter on passed value
setField(string $name, mixed $value, bool $bSafe)
inherited_from | \cApiArticleLanguage::setField() |
---|
string
mixed
bool
Flag to run defined inFilter on passed value
setFilters(array $aInFilters, array $aOutFilters) : void
Examples:
$obj->setFilters(array('addslashes'), array('stripslashes')); $obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));
inherited_from | \Item::setFilters() |
---|---|
inherited_from | \cApiArticleLanguage::setFilters() |
array
Array with function names
array
Array with function names
setProperty(string $sType, string $sName, mixed $mValue) : bool
inherited_from | \Item::setProperty() |
---|---|
inherited_from | \cApiArticleLanguage::setProperty() |
string
Specifies the type
string
Specifies the name
mixed
Specifies the value
bool
store() : bool
inherited_from | \Item::store() |
---|---|
inherited_from | \cApiArticleLanguage::store() |
bool
toArray() : array | false
inherited_from | \Item::toArray() |
---|---|
inherited_from | \cApiArticleLanguage::toArray() |
array
false
toObject() : \stdClass | false
inherited_from | \Item::toObject() |
---|---|
inherited_from | \cApiArticleLanguage::toObject() |
\stdClass
false
unregister(string $event, mixed $class) : void
Example: cGenericDb::unregister(cGenericDb::CREATE_SUCCESS, 'cApiArticle');
inherited_from | \cGenericDb::unregister() |
---|---|
inherited_from | \cItemBaseAbstract::unregister() |
inherited_from | \Item::unregister() |
inherited_from | \cApiArticleLanguage::unregister() |
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Class name for unregistering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if the event or the class are not set |
---|
_executeCallbacks(string $event, string $class, array $arguments) : void
inherited_from | \cGenericDb::_executeCallbacks() |
---|---|
inherited_from | \cItemBaseAbstract::_executeCallbacks() |
inherited_from | \Item::_executeCallbacks() |
inherited_from | \cApiArticleLanguage::_executeCallbacks() |
string
Callback event, must be a valid value of a cGenericDb event constant
string
Class name for executing callback
array
Arguments to pass to the callback function
\cInvalidArgumentException |
if the event or class is not set |
---|
_getArticleContent() : void
$article->content[type][number] = value;
inherited_from | \cApiArticleLanguage::_getArticleContent() |
---|
_getIdArtLang(int $idart, int $idlang) : int
inherited_from | \cApiArticleLanguage::_getIdArtLang() |
---|
int
Article id
int
Language id
int
Language dependant article id_getPropertiesCollectionInstance() : \cApiPropertyCollection
inherited_from | \cItemBaseAbstract::_getPropertiesCollectionInstance() |
---|---|
inherited_from | \Item::_getPropertiesCollectionInstance() |
inherited_from | \cApiArticleLanguage::_getPropertiesCollectionInstance() |
_getSecondDBInstance() : \cDb
inherited_from | \cItemBaseAbstract::_getSecondDBInstance() |
---|---|
inherited_from | \Item::_getSecondDBInstance() |
inherited_from | \cApiArticleLanguage::_getSecondDBInstance() |
_loadByWhereClause(string $sWhere) : bool
This function is expensive, since it executes allways a query to the database to retrieve the primary key, even if the record set is aleady cached. NOTE: Passed value has to be escaped before. This will not be done by this function.
inherited_from | \Item::_loadByWhereClause() |
---|---|
inherited_from | \cApiArticleLanguage::_loadByWhereClause() |
string
The where clause like 'idart = 123 AND idlang = 1'
\cException |
if more than one item could be found matching the given where clause |
---|
bool
True if the load was successful_onLoad() : void
Inherited classes should override this function if desired.
inherited_from | \Item::_onLoad() |
---|---|
inherited_from | \cApiArticleLanguage::_onLoad() |
_outFilter(mixed $mData) : mixed
see | \setFilters |
---|---|
inherited_from | \Item::_outFilter() |
inherited_from | \cApiArticleLanguage::_outFilter() |
mixed
Data to filter
mixed
Filtered data_setMetaObject($sObjectName)
inherited_from | \Item::_setMetaObject() |
---|---|
inherited_from | \cApiArticleLanguage::_setMetaObject() |
$content : array
inherited_from | \cApiArticleLanguage::$$content |
---|
$primaryKey : string
inherited_from | \cItemBaseAbstract::$$primaryKey |
---|---|
inherited_from | \Item::$$primaryKey |
inherited_from | \cApiArticleLanguage::$$primaryKey |
$tab : array
inherited_from | \cApiArticleLanguage::$$tab |
---|
$values : array
inherited_from | \Item::$$values |
---|---|
inherited_from | \cApiArticleLanguage::$$values |
$virgin : bool
If true, the object is virgin and no operations on it except load-Functions are allowed.
inherited_from | \cItemBaseAbstract::$$virgin |
---|---|
inherited_from | \Item::$$virgin |
inherited_from | \cApiArticleLanguage::$$virgin |
$_arrInFilters : array
inherited_from | \Item::$$_arrInFilters |
---|---|
inherited_from | \cApiArticleLanguage::$$_arrInFilters |
$_arrOutFilters : array
inherited_from | \Item::$$_arrOutFilters |
---|---|
inherited_from | \cApiArticleLanguage::$$_arrOutFilters |
$_className : string
inherited_from | \cItemBaseAbstract::$$_className |
---|---|
inherited_from | \Item::$$_className |
inherited_from | \cApiArticleLanguage::$$_className |
$_oCache : \cItemCache
inherited_from | \cItemBaseAbstract::$$_oCache |
---|---|
inherited_from | \Item::$$_oCache |
inherited_from | \cApiArticleLanguage::$$_oCache |
$_settings : array
inherited_from | \cItemBaseAbstract::$$_settings |
---|---|
inherited_from | \Item::$$_settings |
inherited_from | \cApiArticleLanguage::$$_settings |
$cache : array
inherited_from | \cItemBaseAbstract::$$cache |
---|---|
inherited_from | \Item::$$cache |
inherited_from | \cApiArticleLanguage::$$cache |
$db : \cDb
inherited_from | \cItemBaseAbstract::$$db |
---|---|
inherited_from | \Item::$$db |
inherited_from | \cApiArticleLanguage::$$db |
$lasterror : string
inherited_from | \cItemBaseAbstract::$$lasterror |
---|---|
inherited_from | \Item::$$lasterror |
inherited_from | \cApiArticleLanguage::$$lasterror |
$lifetime : int
inherited_from | \cItemBaseAbstract::$$lifetime |
---|---|
inherited_from | \Item::$$lifetime |
inherited_from | \cApiArticleLanguage::$$lifetime |
$modifiedValues : array
inherited_from | \Item::$$modifiedValues |
---|---|
inherited_from | \cApiArticleLanguage::$$modifiedValues |
$oldPrimaryKey : string
inherited_from | \Item::$$oldPrimaryKey |
---|---|
inherited_from | \cApiArticleLanguage::$$oldPrimaryKey |
$properties : \cApiPropertyCollection
inherited_from | \cItemBaseAbstract::$$properties |
---|---|
inherited_from | \Item::$$properties |
inherited_from | \cApiArticleLanguage::$$properties |
$secondDb : \cDb
inherited_from | \cItemBaseAbstract::$$secondDb |
---|---|
inherited_from | \Item::$$secondDb |
inherited_from | \cApiArticleLanguage::$$secondDb |
$table : string
inherited_from | \cItemBaseAbstract::$$table |
---|---|
inherited_from | \Item::$$table |
inherited_from | \cApiArticleLanguage::$$table |
$_callbacks : array
inherited_from | \cGenericDb::$$_callbacks |
---|---|
inherited_from | \cItemBaseAbstract::$$_callbacks |
inherited_from | \Item::$$_callbacks |
inherited_from | \cApiArticleLanguage::$$_callbacks |
CREATE_BEFORE
Expected parameters for callback: none
inherited_from | \cGenericDb::CREATE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_BEFORE |
inherited_from | \Item::CREATE_BEFORE |
inherited_from | \cApiArticleLanguage::CREATE_BEFORE |
CREATE_FAILURE
Expected parameters for callback: none
inherited_from | \cGenericDb::CREATE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_FAILURE |
inherited_from | \Item::CREATE_FAILURE |
inherited_from | \cApiArticleLanguage::CREATE_FAILURE |
CREATE_SUCCESS
Expected parameters for callback: ID of created item
inherited_from | \cGenericDb::CREATE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_SUCCESS |
inherited_from | \Item::CREATE_SUCCESS |
inherited_from | \cApiArticleLanguage::CREATE_SUCCESS |
DELETE_BEFORE
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_BEFORE |
inherited_from | \Item::DELETE_BEFORE |
inherited_from | \cApiArticleLanguage::DELETE_BEFORE |
DELETE_FAILURE
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_FAILURE |
inherited_from | \Item::DELETE_FAILURE |
inherited_from | \cApiArticleLanguage::DELETE_FAILURE |
DELETE_SUCCESS
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_SUCCESS |
inherited_from | \Item::DELETE_SUCCESS |
inherited_from | \cApiArticleLanguage::DELETE_SUCCESS |
STORE_BEFORE
Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::STORE_BEFORE |
inherited_from | \Item::STORE_BEFORE |
inherited_from | \cApiArticleLanguage::STORE_BEFORE |
STORE_FAILURE
This is also likely to happen if query would not change anything in database! Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::STORE_FAILURE |
inherited_from | \Item::STORE_FAILURE |
inherited_from | \cApiArticleLanguage::STORE_FAILURE |
STORE_SUCCESS
Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::STORE_SUCCESS |
inherited_from | \Item::STORE_SUCCESS |
inherited_from | \cApiArticleLanguage::STORE_SUCCESS |