Difference between revisions of "Core"
Line 1: | Line 1: | ||
− | |||
=== PunchCMS Instansiation === | === PunchCMS Instansiation === | ||
==== [[Core/singleton|PCMS_Client::singleton(dsn, account, basePath)]] ==== | ==== [[Core/singleton|PCMS_Client::singleton(dsn, account, basePath)]] ==== |
Revision as of 23:09, 25 December 2008
Contents
- 1 PunchCMS Instansiation
- 2 PunchCMS Methods
- 2.1 get([elementApiName], [recursive])
- 2.2 getElements([elementApiName], [getFirst], [recursive])
- 2.3 getFolders([elementApiName], [getFirst])
- 2.4 getElementById(elementId)
- 2.5 getFieldById(elementFieldId)
- 2.6 getElementByTemplate(templateApiName, [recursive], [random])
- 2.7 getElementsByTemplate(templateApiName, [getFirst], [recursive], [random])
- 2.8 getElementByTemplateId(templateId, [recursive], [random])
- 2.9 getElementsByTemplateId(templateId, [getFirst], [recursive], [random])
- 2.10 getElementsFromParent(elementId, [getFirst], [recursive])
- 2.11 getAliasId()
- 2.12 find(query, filters, [exact], [arrAllowedTypes])
- 2.13 getLanguages()
- 2.14 getLanguage()
- 2.15 getBasePath()
- 2.16 setBasePath(value)
- 2.17 getFilePath()
- 2.18 getDownloadPath()
- 2.19 getFromCache(method, elementId, [arguments])
- 2.20 getSetting(value)
- 2.21 useAliases(value)
- 2.22 setDbConnection([reInit])
PunchCMS Instansiation
PCMS_Client::singleton(dsn, account, basePath)
Instansiate the singleton class. This is done only once during the execution of a page.
PCMS_Client::getInstance()
Get the CMS object instance. This way you don't have to work with a global CMS object.
PunchCMS Methods
get([elementApiName], [recursive])
Get the first element or folder with an optional specific api name from the root folder.
getElements([elementApiName], [getFirst], [recursive])
Get a collection of elements and folders with an optional specific api name from the root folder.
getFolders([elementApiName], [getFirst])
Get a collection of folders with an optional specific api name from the root folder.
getElementById(elementId)
Get an element or folder with a specific id from the CMS. If not found it will return NULL.
getFieldById(elementFieldId)
Get a field with a specific id from the CMS.
getElementByTemplate(templateApiName, [recursive], [random])
Get the first element with a specific template api name from the root folder.
getElementsByTemplate(templateApiName, [getFirst], [recursive], [random])
Get a collection of elements with a specific template api name from the root folder.
getElementByTemplateId(templateId, [recursive], [random])
Get the first element with a specific template id from the root folder.
getElementsByTemplateId(templateId, [getFirst], [recursive], [random])
Get a collection of elements with a specific template id from the root folder.
getElementsFromParent(elementId, [getFirst], [recursive])
Get a list of elements with a specific parent id.
getAliasId()
Get the element id converted from the curent URL alias.
find(query, filters, [exact], [arrAllowedTypes])
Search through the CMS using a query and optional filters.
getLanguages()
Get a collection of all active languages.
getLanguage()
Get the currently active language.
getBasePath()
Get the base path to the website.
setBasePath(value)
Set the base path of the website. This overrides the value from the singleton method.
getFilePath()
Get the base path to files uploaded by the CMS.
getDownloadPath()
Get the base path to files uploaded by the CMS relative to the website path.
getFromCache(method, elementId, [arguments])
Get the output of a method from the cache. If output doesn't exist is will call the method, cache and return the output.
getSetting(value)
Get the value of a setting in the CMS.
useAliases(value)
Set wether aliases should be used or not. Using aliases has a slight performance impact.
setDbConnection([reInit])
This method forces a reset on the internal database connection object.