Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use fluid and headless at the same time #477

Open
lukaszuznanski opened this issue Aug 10, 2022 · 5 comments
Open

Document how to use fluid and headless at the same time #477

lukaszuznanski opened this issue Aug 10, 2022 · 5 comments
Assignees

Comments

@lukaszuznanski
Copy link
Collaborator

No description provided.

@svenpet90
Copy link
Contributor

Would love to have this feature documented!
Would be very handy in one of my upcoming projects 😇

@cweiske
Copy link

cweiske commented Oct 18, 2023

The main problem is that by including headless TypoScript configuration, the page configuration gets overwritten. I'd rather like to use a separate page type num.

@cweiske
Copy link

cweiske commented Oct 19, 2023

I needed both HTML and JSON output, and did not want to manually include single .typoscript configuration files from headless - because that would probably break with the next headless version.

Instead I opted for a TypoScript condition to only include headless configuration when the JSON page type is present.
Conditional TypoScript file includes differ between TYPO3 v11 and v12: v12 supports @import inside conditions, while v11 always includes @import even if they are inside a condition. Using the old INCLUDE_TYPOSCRIPT is the only way to conditional include .typoscript files in v11 v11 docs, v12 docs, v12 typoscript changelog.

Since I am on v11 I used the following code:

<INCLUDE_TYPOSCRIPT: source="FILE:EXT:example/Configuration/ApiTypoScript/setup.typoscript" condition="[getTSFE() && getTSFE().type == 2]">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:example/Configuration/TypoScript/setup.html.typoscript" condition="[getTSFE() && getTSFE().type != 2]">

(I renamed my original setup.typoscript to setup.html.typoscript)

My ApiTypoScript/setup.typoscript imports the headless setup.typoscript and sets the typeNum for page.

getTSFE().type is necessary, because request.getQueryParams()['type'] does not work with PageTypeSuffix site configuration for nice speaking URLs.

(I am using headless 3.4.0)

@tmotyl
Copy link
Collaborator

tmotyl commented Oct 19, 2023

isn't #652 also related?

@lukaszuznanski
Copy link
Collaborator Author

Yes, it is, also it's merged to master, this is PR to 3.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants