[Typo3-dev] Problem: Entry scripts
Ingmar Schlecht
ingmars at web.de
Tue May 4 13:00:06 CEST 2004
Hi developers,
Many front end extensions need to pass something directly to the client
(e.g. browser) without the overhead of the index.php.
Since there is no frame work for those 'entry scripts', many extensions
have to "reinvent the wheel" by doing it their own way.
Examples:
- The NF Downloads extension needs to pass download files that
reside outside of the document root to the client. Thus it uses its
own 'enty script'.
See
http://typo3.org/index.php?id=1383&tx_extrepmgm_pi1[mode]=1&tx_extrepmgm_pi1[showUid]=511&tx_extrepmgm_pi1[cmd]=details&tx_extrepmgm_pi1[DATA][showFile]=pi1%2Fpassdownload.php
- The jpgraph extension was originally passing the graph files directly
to the browser (using an image mime type like image/png)
- The showpic.php file needs to pass only a little HTML file containing
an image tag to the browser. The purpose of the showpic.php file is
to reduce the overhead that would have been there if it would be done
via index.php.
The first lines of almost all of these 'enty scripts' look 100% identical:
<?php
[...]
// *******************************
// Set error reporting
// *******************************
error_reporting (E_ALL ^ E_NOTICE);
// ***********************
// Paths are setup
// ***********************
define('TYPO3_OS',
stristr(PHP_OS,'win')&&!stristr(PHP_OS,'darwin')?'WIN':'');
define('TYPO3_MODE','FE');
define('PATH_thisScript',[.. some ugly stuff to get the path ...]);
define('PATH_site', dirname(PATH_thisScript).'/');
define('PATH_t3lib', PATH_site.'t3lib/');
define('PATH_tslib', PATH_site.'tslib/');
define('PATH_typo3conf', PATH_site.'typo3conf/');
define('TYPO3_mainDir', 'typo3/');
require_once(PATH_t3lib.'class.t3lib_div.php');
require_once(PATH_t3lib.'class.t3lib_extmgm.php');
// *********************
// Timetracking started
// *********************
require_once(PATH_t3lib.'class.t3lib_timetrack.php');
$TT = new t3lib_timeTrack;
$TT->start();
$TT->push('','Script start');
[...]
?>
Possible solution:
Introcucing an entry script framework consisting of a toplevel
frontend script called action.php.
What would this mean to e.g. showpic.php?
Showpic.php would be splitted into two files.
1.) action.php
This file would be called like this:
http://somedomain.tld/action.php?a=tx_cms_showpic&the_usual_showpic_parameters
or with realurls perhaps:
http://somedomain.tld/action/showpic/the_usual_showpic_parameters
2.) typo3/systext/cms/class.tx_cms_showpic.php
This file would be today's SC_tslib_showpic.
Additionally the ext_tables.php file of the extension 'cms' would
contain something like this:
t3lib_extMgm::registerEntryScript('tx_cms_showpic','EXT:cms/class.tx_cms_showpic.php');
Does this make sense to you?
cheers,
Ingmar
More information about the TYPO3-dev
mailing list