[TYPO3] Loading TYPO3 outside TYPO3
derjoerg
joerg at schoppet.de
Sun Mar 19 14:08:44 CET 2006
Andreas Balzer schrieb:
> 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..)
>
Try to start it over the command-prompt "php -f
c:\Programme\typo3\htdocs\typo3wamp\winremote\script.php" and look at
the output.
Sometimes this helps a lot.
e.g.:
- wrong paths
- _cli_winremote is not allowed to be a admin
- look at the log in the be. Perhaps the user has not the necessary
rights to insert a record
- look in the table-content (phpmyadmin), if the record is created
Regards
Joerg
> <?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