Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $path = MODX_CORE_PATH . 'components/quotes/';
- $result = $modx->addPackage('quotes',$path . 'model/quotes/','modx_');
- $output = '';
- if (! $result) {
- return 'failed to add package';
- } else {
- $output .= '<p>added Package</p>';
- }
- $database_server = '**';
- $database_type = '**';
- $dbase = '**';
- $database_user = '**';
- $database_password = '**';
- $table_prefix = '**';
- $xpdo = new xPDO("mysql:host=$database_server;dbname=$dbase",
- $database_user,$database_password,$table_prefix);
- $output .= ($xpdo->connect()) ? '<p>Connected</p>' : '<p>Not Connected</p>';
- /*test for adding new object, commented out
- $newObj = $xpdo->newObject('Quotation');
- $newObj->fromArray(array('quote' => 'sdfjkhjkashf dkashfjkhd skf'));
- $newObj->save();
- */
- $quotes = $xpdo->getCollection('Quotation');
- $output .= '<p>Total: '. count($quotes) . '</p>';
- foreach($quotes as $quote) {
- $output .= '<br />Quote: ' . $quote->get('quote');
- }
- return $output;
Add Comment
Please, Sign In to add comment