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