Include PHP file into TemplaVoilà template through TypoScript

375 Views Asked by At

I need to include a PHP file (containing some database-checks 'n' stuff) into a very bad programmed TYPO3 website. They used TemplaVoilà for templating purposes. This is the definition in the master TypoScript template:

[...]
page = PAGE
page {
    [...]
    10 = USER
    10.userFunc = tx_templavoila_pi1->main_page
    [...]
}
[...]

Within the used TemplaVoilà template they mapped the main content div (where I'd like to insert my PHP script) with the attribute „field_content“. Don't know if this helps to answer my question.

I tried nearly everything I know to somehow overwrite/fill the „Main Content Area“ through TypoScript, as it is completly empty () on the page I created for my PHP file.

Is it possible to fill a specific mapped tag with my PHP file through TypoScript?

(TYPO3 Version 4.5.32)

I figured out a solution for my problem: With the hint in the answer by Urs (using _INT) I altered an already included DS object to be extended through additional sub-objects (as the markup allows my code to be placed there with some modifications to the stylesheet):

lib.social.20 = PHP_SCRIPT_INT
lib.social.20.file = fileadmin/path_to_my_file

Now it works like a charm althrough it's a bit hacky...

1

There are 1 best solutions below

2
On

What about

lib.myscript= USER
lib.myscript {
  userFunc =user_myScript->main
}

and in the DS

<TypoScript><![CDATA[
10 < lib.myscript
]]></TypoScript>  

I'm no TemplaVoilà expert, I just pulled the second snippet from http://typo3-beispiel.net/index.php?id=10

PS: if its's USER, it will be cached, if it's USER_INT, it will prevent static file caching. So you may be better off running those checks in the background via AJAX?