Jump to content

Fuzzy

Members
  • Content Count

    19
  • Joined

  • Last visited

Everything posted by Fuzzy

  1. Thanks, @kixe! The code is working, BUT: all data displayed which are not stored in a field on this page still fallback to the default language (e.g. navigation and footer --> template include; translated strings --> _("xyz") . No surprise, but I did not consider this. Is there a way to overwrite the language fallback behaviour of Processwire globally? - I searched the forum, but could not find any information about that...
  2. @kixe, you are the best! But I think, you already knew that! Is it possible to do this for every field of a page? - The code below isn't working... if ($user->language->id == "20025") { $languageFallback = [15151,1010]; // array of Language-IDs in fallback order for LATAM } else { $languageFallback = [1010]; // array of Language-IDs in fallback order for all other languages } $pageActiveLanguageIds = $page->getLanguages()->each('id'); $languageFallback = array_intersect($languageFallback, $pageActiveLanguageIds); foreach ($page->fields as $field) { $field = ''; f
  3. Thanks @7Studio. But the default language is still English then. What I'm looking for is: Currently in Processwire: Check if content is available in a specific language If not, content will be shown in the default language. What I want: Check if content is availbale in a specific language If not, check if language is available in primary fallback language for this specific language If not, content will be shown in the default language.
  4. Hi, Currently we have set up a multilanguage site using multilang URLs and multilang fields. English is used as default/fallback. Now we have to create two spanish language versions (Spain-Spanish + LATAM-Spanish). Is it possible to define for LATAM-Spanish as primary fallback Spain-Spanish. If content is not available in Spain-Spanish publish in default language? Thanks for pointing me in the right direction...
  5. Thanks @gebeer for the detailed description and code snipets. Managed to get a workaround as my knowledge of js is too limited to get the callbacks working. Nevertheless, thanks a lot for your help!
  6. I know it's not a PW issue, but maybe someone can help me anyway! I managed to implement Klaro! on my website for all relevant scripts except for Google Maps. The script gets blocked successfully but when accepting cookies/other services, the script doesn't get called. I guess that the callback function is the reason for this. But I'm not able to fix it and can't find example code. This is what I've tried: { name: 'googleMap', title: 'Google Maps', purposes: ['externaltracker'], description: ['styling'], callback : function(consent, app){ }, }, And also the code below doesn't
  7. Thanks to both of you, @MoritzLost and @Robin S. In my case Robin's idea did the trick 😉
  8. Hi, is there a possibility to check if a page is before/after another page in the admin page tree? Example: > Categories >> In Progress >> Completed >> Waiting for Approval What I'm looking for is an if statement that checks whether "Completed" is before/after "In Progress" in the page tree. Checking the ID is not an option as "In Progress" might have been created after "Completed". Thanks in advance for your help!
  9. Gnah! Yes, that was a stupid question! Thanks @Soma for bringing me back on track!
  10. Hi everyone! On my multilanguage website - let's say English and French - I would like to have a page "Downloads" where files (PDFs) are listed. Most files are available in both languages and I would like to link the English version as well as the French version of the PDF. To setup the Download pages I followed @Soma's tutorial using language alternate fields for the PDFs and managed to display both version of the PDF with the correct language-specific URL foreach($allLanguages as $language) { $html .= "<a href='{$item->getLanguageValue($language->id, 'url')}' target='
  11. Still not getting it. Removing namespace Processwire from ready.php solved the error but the 404 is still being displayed. After some investigations included the following in config.php - but no effect... $config->templateCompile = false; $config->moduleCompile = false; Any ideas?
  12. ProcessWire 2.7.3 and code is placed in file ready.php which is in folder "site". I've only changes the page id...
  13. Hi @kixe, Sorry to bother you again. Could you please check your code again? I get the following error Error: Class 'ProcessWire\HookEvent' not found (for this line $event = new HookEvent(array('object' => $otherPage)); ) PS: Sorry, I'm still learning and have to admit that hooks are out of my range...
  14. I'm trying here, but no luck so far.
  15. Thanks @kixe and @Sergio for trying to help me. I've added @kixe's code at the top of my prepend.inc (and changed the page id) but the 404 is still displayed. I also tried ProcessPageView::pageNotFound instead of PageRender::renderPage - but without success! Any ideas?
  16. Hi there, Can't find a solution for this problem (although it sounds quite easy): If a page exists but is not active in the current user's language there should be an alert with "content not available for your selected region" instead of displaying the 404-page. I tried this: // if page is not active in current user language show alert, instead of 404 page if($page->name != 'http404' && !$page->viewable($user->language)) { $page = $pages->get('id=17104'); // this is the page containing the content-not-available-in-your-region-message } It works when log
×
×
  • Create New...