Reputation: 17
I'm using TYPO3 11.3.3 for my server and i need a PHP Script, that can read and check the typo3_fe cookie. Are there any solutions? I can't use an extension and I have to keep it simple.
Upvotes: 0
Views: 356
Reputation: 1956
Cookies are being sent along with the request. With that being said, the best way to check for the cookies is Middlewares. With the middlewares you can check for the sent cookies and evaluate them with your script.
Here is the documentation about middlewares.
This might be helpful as well https://stackoverflow.com/a/63951593/7162477
Best regards
Upvotes: 0
Reputation: 3787
What exactly should the PHP script do apart from reading the cookie? You can use a TypoScript condition to check if the cookie is present:
[request.getCookieParams()['foo'] == 1]
See the documentation for details.
Upvotes: 1
Reputation: 7939
The only way would be a content object USER
. Check out the documentation.
Example
page = PAGE
page.10 = USER_INT
page.10 {
userFunc = Vendor\ExtensionName\ExampleTime->printTime
}
However the doc also states
The property includeLibs has been removed in TYPO3 8.0. In earlier versions the userFunc classes were sometimes stored in fileadmin/ - this is no longer possible out of the box and not recommended.
For the best result you should always, without exception, place your class files in an extension, define composer class loading for this extension and add this extension as a dependency of your project. Then, your classes will load without issues when you refer to them by their class name.
Upvotes: 0