Site management and application context TYPO3 9 - typo3

In TYPO3 9 is a new feature Site Management, where a 'Site Configuration' can be created. Among the requested fields there is 'Entry point' where the domain name can be given which will be used for creating 'full URLs', allowing to renounce an extension like RealUrl.
After filling in the fields a file gets created at /config/sites/mysite/config.yaml
How can this file be loaded or change settings in it, depending on the so called application context / environment variable TYPO3_CONTEXT, since different domain names will be used for development, testing and production. Also locales could be spelled different.

Please look at 9.5 LTS; the ticket https://forge.typo3.org/issues/86303 has been resolved with the "site variants"; I add here a screenshot of the Site Configuration module with a variant added (taken from the latest TYPO3 Master).

At the moment it isn't possible. We deploy different files to the different systems for this ... Ticket is https://forge.typo3.org/issues/86303

Related

using TYPO3 core hooks only in one site of a multi site installation

i defined a hook in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typoLink_PostProc']['titleTagsInHiddenText'] = SNM\StmwiAccessibility\ExtendTypolink::class . '->convertTitleInHiddenText';
This hook will be executed on every link on the page, on all pages of all sites. This could be a performance killer ...
So, is there a possibility to restrict the use of the hook to the actual page? Is it possible to get the current site in ext_localconf.php?
e.g.:
$currentSite = ????;
if ($currentsite = 'rootPidOfMySite') {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']
}
This question rises in other contexts too: i often want to restrict the performance consuming configuration of extensions to one single site. I can do it with the static setup file but not with the stuff in ext_localconf.php.
Thanks!
Which TYPO3 version do you use? There is an API to access the site configuration. I'd say you need to register PSR-15 middleware and then you can access the site configuration. More details can be found in the documentation.

Fetching all base URLs from site config in TYPO3

In an extension we build for TYPO3 8 we check if a URL entered by a user is a local URL by checking the domain against records in the sys_domain table. We're now updating that extension for TYPO3 9 and 10. sys_domain has been deprecated in TYPO3 9 and removed in 10. It has been replaced with settings in the site configuration.
Is there an easy way to fetch all known base URLs (including variants and languages) from the site configuration without parsing and looping through the site configuration myself?
Yes it is possible. You need to use the PHP API: Accessing Site Configuration
here is an example:
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
$allsites = $siteFinder->getAllSites();
This is the results
Best regards

TYPO3 REST Extension setup

I'm trying to setup the REST-Extension v2 in TYPO3 8.7 following this tutorial. I included the 2 templates called Virtual-Object-Page and Virtual-Object-Content in my template. I made a new extension using Extension Builder 8.7 from Github with a simple model. I installed the new extension and made some Instances of my model in the List View on my start page. In the Typoscript of my template I added:
plugin.tx_rest.settings.paths {
1 {
path = me-kinder-child
read = allow
write = allow
}
}
Me is the Vendor, kinder my extension key and child is my model.
When I'm calling http://localhost/rest/ I get The requested URL /rest/ was not found on this server.
What am I missing?
The path in the setup is explained being possible with several options, so perhaps try different configuration, possible is also all.
I don't see a fault in your setup, so the fault might be related to the server-file .htaccess or the extension realurl respectively the combination of both perhaps.
If you try it already with realurl or cooluri then disable that to get it running without first.
The htaccess file you can disable first too and enable it later again to adjust all requirements to each other.
The problem was not about RealURL was missing in any way. I just did not clear a cache that got cleared while installing RealURL. I guess that the "Clear all caches"-button in the Install-Tool would do it too.

Eclipse: How can I set the {user} variable?

I'm using Eclipse (v3.5.2 to be exact), and the several of the plugins I'm using use the {user} field to populate various things (for instance, Egit puts the username and email address in commits, and the StatEt plugin for R puts the username as the Authour tags in roxygen Rd doc files.)
However, On my system my username is meaningless to anyone outside of the company. Is it possible to change this field to something more sensible like "Paul Hurley" (and similarly to set an email address), either manually, via a configuration or via some script on load ?
I always modify some eclipse settings in ECLIPSE_HOME\eclipse.ini file.
-Duser.country=EN
-Duser.language=en
-Duser.name=Matthieu BROUILLARD [matthieu#somewhere.org]
Overriding those properties is very usefull especially for bad translation in your local language. For me for example SVN plugins are really difficult to use with french translation.
Hope this helps.

TYPO3 - how to set the <base> tag in the header of generated html pages?

I have inherited ownership of a website running on TYPO3 version 4.2.1. There are two pages that are not rendering correctly, and this seems to be down to a failure to load css and javascript files. Inspecting the page source, I can see that the <base href="blah..." /> tag is missing from the page header.
The question: how on Earth do I set the base url property in TYPO3!?
I have poured over the Typo3 website, edited various "typoscript" files, offered sacrafices to the PHP gods, all to no avail. The generated code still does not include the tag.
Any help appreciated. Please note it is not possible for me to "upgrade to the latest version", and my PHP knowledge is non-existant.
Adding this line to the "Setup" field of your site's main TypoScript template ought to do it:
config.baseURL = < URL here >
The "TSRef" (TypoScript Reference) is a key document for every TYPO3 site administrator -- it's available online here:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/current/
I recommend printing out a copy to keep at your desk, you will be referring to it frequently. (They provide it in OpenOffice format as well, to make this easy.)
Section 1.6 ("Setup") describes all the properties you can set via TypoScript's CONFIG object:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.0/view/1/6/#id2512147
P.S. While I wasn't going to recommend you download the latest version to fix this problem, I will recommend you download the latest version to be sure you haven't missed any security patches.
Here is how to set the baseurl within the v4.5 introduction package:
Template > Home > Edit Whole Template Record
Includes (between Options and Recources tab )
Click on the little template icon to the left of ROOT, choose Edit
Under Constants > Config, enter the base domain as shown below (leave out the <>
Rememember to clear all cache and then to Ctrl + F5 to complete refresh the browser
TS:
config {
# cat=config; type=boolean; label=Admin Panel: Turn on admin panel (mainly for testing purposes only)
adminPanel = 0
# cat=config; type=boolean; label=Debugging: Turn on debugging (testing purposes only)
debug = 0
# cat=config; type=string; label=Domain name for Base URL: (excluding slashes and protocol like http://)
domain = < ENTER YOUR DOMAIN HERE >
}