Reputation: 226
It was years ago when I last used TYPO3 intensively. So I don't remember much TYPO-Script. When I updated to 6.0, I found out, that this code is no longer working:
marks.CONTENT.30 = PHP_SCRIPT
marks.CONTENT.30.file = fileadmin/db/db.php
It simply inserted the html output of the db.php (which did some database requests and formed a customized html/css table out of it).
How can I fix this quickly? I've heard that PHP_SCRIPT was deprecated, and that there is another keyword (USER), but I don't know, how to use it. Remember: I'm really no TYPO-Script expert any more, so feel free to explain in detail. ;-)
Thanks! Ingo.
Upvotes: 3
Views: 2163
Reputation: 3228
Looks like you need a basic extension, which, as you mentioned, is simply USER or USER_INT content objects.
First one is cached within a page content, so, if you script outputs some static or rarely changed info, you should consider to choose USER type.
If you have dynamic data, which changes frequently (every new page load brings new output), then you'd rather take USER_INT, but be aware: USER_INT script is called every time your page loads, so you must optimize it as much, as possible.
I advise you to read this basic info about usage of these two types.
So, at the end you need a PHP class, which name starts from 'user_' or 'tx_' with a main() method, which takes two params $content and $conf. These params will not be used by you, but FYI, $content may contain pre-processed content, and $conf contains any configuration data, needed for your script.
Inside of main() you create your HTML output and just return it (as string).
TS part will be following in case of USER:
includeLibs.something = fileadmin/db/db.php
marks.CONTENT.30 = USER
marks.CONTENT.30 {
userFunc = user_db->main
}
For USER_INT:
marks.CONTENT.30 = USER_INT
marks.CONTENT.30 {
includeLibs = fileadmin/db/db.php
userFunc = user_db->main
}
NOTE: I've described dirty, but easy way for your case. Much better will be consider using CONTENT cObject, because it does exactly, what you need: fetches records from DB and outputs them on page in a way, that you like.
Upvotes: 6