Multi language category sets
I'm working on a multi language website, I currently have two collections called:
- Solutions EN
- Solutions DE
I'm trying to reduce the number of templates I need, by passing in a language variable called
Instead of doing this:
perch_collection('Solutions EN', [ 'template' => solutions_en.html', ]); perch_collection('Solutions DE', [ 'template' => solutions_de.html', ]);
I'm doing this:
perch_collection('Solutions ' .$lang, [ 'template' => solutions.html', ]);
This means I can have one detail template
solutions.html instead of two, and possibly more, if more languages are added at a later date.
However, I've hit a bump with this approach.
I need the detail template to use a language specific
category set, so the slugs are in the correct language.
solutions.html I have this:
<perch:categories id="solutions_en" set="solutions-en"> <perch:categories id="solutions_de" set="solutions-de">
collections use the same
But, this means the user sees both category sets regardless of what
solution collection they're editing.
Is there a way to hide a
category set in a detail template based on the current collection?
So, If the user was editing the
Solutions EN collection, they wouldn't see the
Solutions DE category set.
Or is the recommended approach to use a unique detail template per collection?
Perch Runway: 3.1.1, PHP: 7.1.12, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO Server OS: Darwin, cgi-fcgi Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1) App runtimes: <?php $apps_list = [ ]; PERCH_LOGINPATH: /perch PERCH_PATH: /Users/stephen/Repositories/project/cms/perch PERCH_CORE: /Users/stephen/Repositories/project/cms/perch/core PERCH_RESFILEPATH: /Users/stephen/Repositories/project/cms/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M F1: 3b606135b33e6a102526838f4152a807 Resource folder writeable: Yes SCRIPT_NAME: /perch/core/settings/diagnostics/index.php REQUEST_URI: /perch/core/settings/diagnostics/ DOCUMENT_ROOT: /Users/stephen/Repositories/project/cms HTTP_HOST: project.local
Want to reply to this thread?Login with Perch