How to set domain for cookie while getting the domain from flexform

92 views Asked by At

I want to use a cookie across several sub-domains (say www.website.com, shop.website.com). Furthermore the base-domain (at least I believe it's the base-domain, say website.com) has to be provided by the user of the Content Management System via an input field provided by the system. I then have to read that string and set it as domain for the cookie in JavaScript. The difficulty is that I don't know how to get that string from the input field. I'm using flexforms of the TYPO3 CMS (to let the user provide the domain as a string).

I definitly need help with that question.

Flexform is a technique of TYPO3 to provide custom configuration options for a website (frontend or backend) built by this CMS.

1

There are 1 answers

0
MightyA On

I found a solution on my own: I pass the value from the flexform via viewhelper ...

<div class="className" {f:if(condition: '{settings.valueFromFlex}', then: 'data-value="{settings.valueFromFlex}"', else: '')}>contentOfTheDiv</div>

... as data element to an html element (of the template) and grab it from there with jQuery via ...

$(".className").data("value");