Download the PHP package zeroseven/z7-countries without Composer
On this page you can find all versions of the php package zeroseven/z7-countries. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zeroseven/z7-countries
More information about zeroseven/z7-countries
Files in zeroseven/z7-countries
Package z7-countries
Short Description This TYPO3 extension offers the possibility of a flexible country configuration for single tree content.
License GPL-2.0-only
Informations about the package z7-countries
Countries :jp: :us: :fr: :es: :it: :ru: :gb: :de:
This TYPO3 extension offers the possibility of a flexible country configuration for single tree content.
Languages that exist in TYPO3 can be split up to match single countries. You can therefore limit content of different languages to only be displayed for chosen countries. For a clean and easy to understand administration in the backend, this extension uses dynamic icons, country filters and more.
Example usage:
Let‘s take the German language. With this extension it’s possible to subdivide the language “German” into the countries “Germany”, “Austria” and “Switzerland” in order to limit selected content to individual countries.
In this example, in addition to the German language URL of the website (example.com/de/schweiz
), other URLs are automatically available:
example.com/de-de/schweiz
example.com/de-at/schweiz
example.com/de-ch/schweiz
Now, if a content element, a page or any other database record has exclusively been made available for the country Switzerland, it would only be available under example.com/de-ch/schweiz
(note the de-ch) but not on the other example urls.
In this example, the content restricted to Switzerland could also be available in other translations, so it can be viewed in other languages:
example.com/en-ch/switzerland
example.com/it-ch/la-suisse
example.com/fr-ch/svizzera
How it works:
With every country that is assigned to a language, the language is made available under an additionally altered base URL. This consists of the ISO Code of the language and a country parameter.
When accessing a page with a language country combination like that in the URL, all database queries on configured tables will be made with these country restrictions in mind.
:bulb: Therefor the href in the site configuration should only contain the language (e.g. "fr" instead of "fr-FR").
SEO:
There’s no need to worry here. Aside from the URLs, the hreflang as well as the lang attribute of the page are getting altered. This way, the search engines find a perfectly fine identifiable and correct country variation. To put it simple: there will be no duplicate content complaints.
Examples for hreflang tags:
For administrators:
Installation:
Get the extension via composer: composer require zeroseven/z7-countries
Configuration:
- On root level (
uid:0
), create a various amount of countries as data records. - Assign countries to the languages via the TYPO3 site config.
- Extend desired data record types for restricting to countries. Example:
:bulb: The database analyzer in the install tool will automatically add the needed fields to your database when running it.
Extend country objects
To extend the country object, extend the database table tx_z7countries_country
. The country model automatically provides a set
,get
, has
and a is
method for each field.
Example:
Country template condition
ViewHelpers
With the extension's own ViewHelpers it's possible to create country dependent structures in a template.
For this‚ you can use any parameter that is available in the Country
object.
TypoScript conditions
In the TypoScript setup, settings can be defined depending on the selected country.
For this, the Country
Model is available for Conditions.
Editor:
Adjust country settings for a data record:
If the data record type has been made available for country configuration, the record can now be restricted to specific countries.
Language/country check:
When creating or editing a data record, there will be checks if it’s even displayed under current country settings in the chosen language. This way, you can avoid any wasted efforts on misleading configuration.
Country filter:
In the list module, there’s a filter available for you. Now you can check which content is available for any chosen country without any effort.
Automatic redirect:
When the start page is called up, an attempt is made to redirect the user to a suitable language/country URL according to his browser settings. For this, the following conditions must be met:
- The domain is called without any path
- The referer has the same URL origin
- No bot could be determined
If you want to disable or override the automatic redirects, take a look at TYPO3's middleware API.
Example of disabling the redirect feature:
The configuration must be provided in Configuration/RequestMiddlewares.php
of an extension:
All versions of z7-countries with dependencies
jaybizzle/crawler-detect Version ~1.2
doctrine/dbal Version ^2.13.0
ext-json Version *
php Version ^7.4 || ^8.0