[Typo3-dev] Stand alone script

Pierre Rouwens prouwens at infoglobe.ca
Sat Dec 3 01:00:08 CET 2005


Hi T3ers,

I need to use this in a standalone script :

$cObjLocal = t3lib_div::makeInstance("tslib_cObj");
$objContent = array('table' => 'tt_content',
                     'select.' => array('pidInList' => 
t3lib_div::GPvar('pageID'),
                     'orderBy' => 'sorting','where'=>'colPos=0'));
$renderedContent = $cObjLocal->CONTENT($objContent);

i've search in another T3 file how i have to this... but i've problems ...

this is my complete script :

----------------------------------------------------------------------------
// ******************
// Constants defined
// ******************
define('TYPO3_OS', 
stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
define('TYPO3_MODE','BE');
define('PATH_thisScript',str_replace('//','/', str_replace('\\','/', 
(php_sapi_name()=='cgi'||php_sapi_name()=='isapi' 
||php_sapi_name()=='cgi-fcgi')&&($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED'])? 
($_SERVER['ORIG_PATH_TRANSLATED']?$_SERVER['ORIG_PATH_TRANSLATED']:$_SERVER['PATH_TRANSLATED']):($_SERVER['ORIG_SCRIPT_FILENAME']?$_SERVER['ORIG_SCRIPT_FILENAME']:$_SERVER['SCRIPT_FILENAME']))));
define('PATH_site', ereg_replace('[^/]*.[^/]*$','',PATH_thisScript));
define('PATH_typo3conf', PATH_site.'typo3conf/');
define('PATH_t3lib', PATH_site.'t3lib/');
define('TYPO3_mainDir', 'typo3/');
// ******************
// Including config
// ******************
require_once(PATH_t3lib.'class.t3lib_div.php');
require_once(PATH_t3lib.'class.t3lib_extmgm.php');
require_once(PATH_site.'tslib/class.tslib_content.php');

require(PATH_t3lib.'config_default.php');
if (!defined ('TYPO3_db'))     die ('The configuration file was not 
included.');
if (!$TYPO3_CONF_VARS['GFX']['image_processing'])    die 
('ImageProcessing was disabled!');

require_once(PATH_t3lib.'class.t3lib_db.php');        // The database 
library
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');

$cObjLocal = t3lib_div::makeInstance("tslib_cObj");
$objContent = array('table' => 'tt_content',
                     'select.' => array('pidInList' => 
t3lib_div::GPvar('pageID'),
                     'orderBy' => 'sorting','where'=>'colPos=0'));
$renderedContent = $cObjLocal->CONTENT($objContent);
$output = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$output .= '<ajax-response><response type="element" id="zonePreview">';
$output .= $renderedContent;
$output .='</response></ajax-response>';
header("Content-Type: application/xml; charset=ISO-8859-1");
header("Pragma: no-cache");
print($output);
-----------------------------------------------------------------------------

First at all i need to setup manually the constant PATH_site ... not 
really distirbing in fact ...
When i try to execute i've problem in cObj

do i miss something ...
the goal of this is a script that render a page content thant can be 
handle by ajax in xml format.

Any idea please ???

Thanks for all in advance.

cheers




More information about the TYPO3-dev mailing list