This article is covered in detail in the “doc_core_tsref” here:
http://typo3.org/documentation/document-library/references/doc_core_tsref/current/
Check the article “1.12. PHP include scripts” and 1.13. Case story for detailed info.
In short we can easily include a script in two ways.
Both these code must be written in the setup section of a template record.
- Using the CONFIG object.
ex:
config.includeLibrary = fileadmin/templates/myscript.php - Using the PAGE object.
ex:
page.100.file = fileadmin/templates/myscript.php
That should do the trick. Fo more info I suggest that you please refer “doc_core_tsref“.