Core/singleton

From PunchCMS
Revision as of 00:33, 24 December 2008 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

PCMS_Client::singleton(dsn, punchId, basePath)

Overview

Instansiate the CMS object using the database connectionstring, punch account id and website base path. This is done only once. For the rest of the code execution an instance of the CMS object can be obtained by using the PCMS_Client::getInstance() call.

Arguments

dsn [string]
Should be a valid database ConnectionString.

punchId [string]
The account string generated by the CMS.

basePath [string]
Absolute path to the root folder of the website.

Returns

The CMS object instance.

Example

$strDSN = "mysql://user:password@localhost/database?charset=utf8";
$strAccount = "dfg8979r";
$strPath = dirname(__FILE__) . "/";
 
$objCms = PCMS_Client::singleton($strDSN, $strAccount, $strPath);