[TYPO3] Loading TYPO3 outside TYPO3

Andreas Balzer eMail at andreas-balzer.de
Sat Mar 18 23:38:14 CET 2006


derjoerg schrieb:
> Johannes Reichardt schrieb:
>> Hi there,
>>
>> i have some neat functions in my own extensions that use the dbal and 
>> other Typo3 functions. But i also have a script outside the scope of 
>> typo3 (for a cronjob) that uses these functions.
>>
>> The point is, that i am confused how i can properly "load" typo3 and 
>> its classes so i can access them from an "outside" script. Would be 
>> glad if someone has some hints. Unfortunatly i have not much knowledge 
>> about handling classes in general and moreover handling classes with 
>> typo3 ;)
>>
>> - Johannes
> 
> Look at 
> http://typo3.org/documentation/document-library/core-documentation/doc_core_inside/current/view/3/5/ 
> 
> 
> and search for "CLI mode".
> 
> Joerg Schoppet

Hi!
I tried it, but it doesn't really work :-/
Here is my try.. Can you help me and say me, what i have done wrong? (i 
know, it's very unsecure, but it's just my first try..)

<?php
/*This file should create a BE cli connection to the user _cli_winremote 
with pwd winremote
  This file is in
c:\Programme\typo3\htdocs\typo3wamp\winremote\
Typo3 BE is in
c:\Programme\typo3\htdocs\typo3wamp\typo3\

As soon as a connection is set up, this file should simply create a new 
page.
The only id that's already used is 1, so we create the pid 2.

Problem: It does not work, no output, nothing..

(Script is opened via Webbrowser..)
*/

// *****************************************
// Standard initialization of a CLI module:
// *****************************************
// Defining circumstances for CLI mode:
define('TYPO3_cliMode', TRUE);

// Defining PATH_thisScript here: Must be the ABSOLUTE path of this 
script in the right context:
// This will work as long as the script is called by it's absolute path!
//define(PATH_thisScript, $_ENV['_'] ? $_ENV['_'] : $_SERVER['_']);
define(PATH_thisScript, 
'c:/Programme/typo3/htdocs/typo3wamp/typo3/init.php');

// Include configuration file:
define('TYPO3_MOD_PATH', 'c:/Programme/typo3/htdocs/typo3wamp/typo3/');
$BACK_PATH = '../typo3/';
$MCONF['name'] = '_CLI_winremote';

// Include init file:
require($BACK_PATH.'init.php');




require_once (PATH_t3lib."class.t3lib_tcemain.php");
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;

$inhalte['pages']['2'] = array(

     "title" => "The page title",

     "subtitle" => "Other title stuff",

     "pid" => "2"

);

$tce->start($data,$inhalte);

$tce->process_datamap();

?>





More information about the TYPO3-english mailing list