Reputation:
In the TYPO3 backend, in the Web -> Template Section, in a template´s Setup text entry, I want to include a typoscript using the @import
syntax.
I have setup my local Typo3 v9.5.5 test instance (Windows) inside a folder typo3
, which itself is inside of the htdocs
folder (it is a XAMPP installation). So the url to the backend is http://localhost/typo3/typo3/index.php
, notice the duplication of typo3
. The reason is, i have set up a few CMSes in the htdocs folder, each within a folder having the corresponding name.
Where do i have to put the script inside of the typo3 folder, and what would be the correct code line which includes it?
I tried all kind of paths, like @import 'EXT:typo3testsite/TypoScript/playaround.typoscript'
, and putting the script under htdocs/typo3/TypoScript/playaround.typoscript
or under htdocs/typo3/typo3conf/sites/typo3testsite/TypoScript/playaround.typoscript
, but no success.
The site ID, set up under Site Managment -> Sites, is typo3testsite
.
The script content, for now, is
page = PAGE
page.10 = TEXT
page.10.value = Hello World
When i have cleared constants and setup from parent templates i get Service Unavailable (503). When i put the code directly into the Setup entry it correctly shows 'Hello World' on the front page.
Upvotes: 0
Views: 1022
Reputation: 220
Usually you would store your TypoScript files in a custom extension here;
http://localhost/typo3/typo3conf/ext/customTemplates/Configuration/TypoScript/Setup.ts
(you can give "customTemplates" any name you like)
You can then include that in the TYPO3 Backend like this:
<INCLUDE_TYPOSCRIPT: source="FILE:typo3conf/ext/customTemplates/Configuration/TypoScript/Setup.ts">
__
edit: Since TYPO3 v9.0 there's a simplified import statement. The following is from the TYPO3 Changelog documentation. https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.0/Feature-82812-NewSyntaxForImportingTypoScriptFiles.html
# Import a single file
@import 'EXT:myproject/Configuration/TypoScript/randomfile.typoscript'
# Import multiple files in a single directory, sorted by file name
@import 'EXT:myproject/Configuration/TypoScript/*.typoscript'
# Import all files in a directory
@import 'EXT:myproject/Configuration/TypoScript/'
# It's possible to omit the file ending, then "typoscript" is automatically added
@import 'EXT:myproject/Configuration/TypoScript/'
Upvotes: 0
Reputation: 592
You can do it this way
# Import a single file
@import 'EXT:myproject/Configuration/TypoScript/randomfile.typoscript'
# Import multiple files in a single directory, sorted by file name
@import 'EXT:myproject/Configuration/TypoScript/*.typoscript'
# Import all files in a directory
@import 'EXT:myproject/Configuration/TypoScript/'
# It's possible to omit the file ending, then "typoscript" is automatically added
@import 'EXT:myproject/Configuration/TypoScript/'
See New syntax for importing TypoScript files
The example is useful, when you have an own extension. 'myproject' is then the name of your extension. After 'EXT:' comes the path to the configuration file in your extension.
If you have never built an own extension: Developing TYPO3 Extensions with Extbase and Fluid
Upvotes: 2