[TYPO3-english] Execute php script file including html headers

Jigal van Hemert jigal.van.hemert at typo3.org
Wed Apr 6 14:44:26 CEST 2016


Hi Script Grandpa,

It's customary in TYPO3 mailing lists/forums to use our real names.

On 06/04/2016 13:24, Script Grandpa wrote:
> Dmitry Dulepov wrote:
>> This is not a TYPO3 URL. This is a direct call to the script.
>
> Well, my question was on how to correctly do it. That's why I titled the
> urls "Example".
> Are you saying, that Typo3 (pages) cannot evaluate (custom) url parameters?
> So something like www.somedomain.com/getpic?imgsize=250 could never work
> with Typo3?

It could work, but later you actually mention desired functionality that 
shows that you don't want TYPO3 to do anything with your parameters.

> Dmitry Dulepov wrote:
>> Why do you want TYPO3 to execute this script? It does not make sense.
>
> On that specific server a single Typo3 installation is serving multiple
> domains / web sites. So apache forwards every request to Typo3's
> index.php and Typo3 serves accordingly. My script is supposed to be
> available as a page in one of the domains, next to a whole bunch of
> other pages generated for that domain by Typo3. If I fiddle with apache
> to redirect that specific domain to another subdir just to execute my
> script, I loose all the other (Typo3) pages for that specific domain. As
> far as I can see, I am stuck with Typo3 here.

The .htaccess example that comes with TYPO3 has a few lines that will 
check if the file/directory/link that is requested actually exists and 
only if that is the case it will forward the request to index.php:

# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with 
'%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]

So, you could actually have your script in the installation and you can 
call it.

You also mention that it should "be available as a page in one of the 
domains". If it needs to be in the menu just like one of the TYPO3 pages 
that you can insert it in the page tree as a page of type "redirect". In 
the page properties you can put the URL and the result is that if a 
visitor clicks on the menu item they will visit your custom script.

For your information: custom content that cannot be done with the 
available content elements can be done with several possibilities in TYPO3:

- TypoScript; this is the configuration language of TYPO3, but it is 
also capable of processing data and generating images. It's pretty 
complex to master

- Extensions; A combination of configuration files and PHP code that 
uses the TYPO3 API to communicate with the rest of the system. It allows 
you to make plug-ins that can be inserted in a page, custom content 
element types, backend modules, all kinds of services, modifications of 
core functionality, etcetera. There are extensions to help you kickstart 
an extension, but to make it work requires knowledge of the TYPO3 API 
and extension building.

If you're not interested in developing for TYPO3 the quick solution 
might be the easiest solution for you.


-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-english mailing list