Search the Community
Showing results for tags 'switch'.
-
I wasnt quite sure where to post this (perhaps the AIOM thread is the correct place, if so I am sorry).. But I have a switch statement set up on certain values in an options. I have that part working like a charm.. However, when I echo: echo "<link rel=\"stylesheet\" href=\"{AIOM::CSS(array('styles/style.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; It just returns a link. It is like it is rendering one linked file and I receive a 404 error. DId I escape the "" the wrong way? switch ($switchColor) { case "Style3": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style3.css'));}\">"; break; case "Style4": echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css'));}\">"; break; default: echo "<link rel=\"stylesheet\" href=\"{echo AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/normal.css'));}\">"; } I should have actually tried assigning it to a variable and then passing that in to the switch before I posted this. I solved it by assigning the AIOM array to a variable. So apparently that isnt working either.
-
Hi, noob here. Maybe this has already been addressed, but I can't find it in the forums. Also, is this really where one may file a defect report? Anyway, implementing a multi-language site. I started out single language. Created body, summary, headline fields in some of the templates. Created pages w/ templates, populated some of these fields. Then I tried to change, say, summary, from Text to TextLanguage and got 1 green and 2 red bands at the top when saving: Field type changed Field type change failed. Database reports: SQLSTATE[HY000]: General error: 1364 Field 'data1027' doesn't have a default value Error changing fieldtype for 'test', reverted back to 'FieldtypeTextLanguage' (Woah! They're formatted here! I might see data getting clobbered during a field type transition, but this is an good ol' error. With a field that's already used in templates, I can't edit the field unless I remove it from every template. With a brand new field, just pressing [save] again works clears the error. Basically, changing the field type toward multi-language doesn't work, yet it's allowed. p.s. Niceties galore! What a superb CMF!!!
-
I would like to create a language switch using Multi-language page names, but I have for each language a different domain. For example: domain.com instead of domain.com/en/ domain.de instead of domain.com/de I was finding various approaches and explanations, outdated and brand-new, but I think It would be great to gather everything in one place. So there are basically two questions: A) How to autodetect the browser language and redirect to the specific domain or default when not available. My approach would be to direct all domains to the default, in this case domain.com, and then let processwire redirect depending on the browserlanguage. B) How to create a manual switch with flags, to choose the language for the current page you are viewing, changing the path from: domain.com/about/ domain.de/ueber-uns/ Thanks a lot and I will update this post with the code we together brainstorm. Starting with connecting the domain to the language in processwire. <?php // Redirect to language fields of processwire if($config->httpHost == 'domain.de') { $user->language = $languages->get("deutsch"); } ?>
-
hi there, this is my first post in the forums, and i got to say that up to this point working with process wire was a really easy-going experience. now i'm not quite sure if i'm just over-thinking my whole problem and i hope someone can help me. i have a setup of processwire running with german as default and english as additional language. i successfully implemented a language-switcher which works like a charm. now i want processwire to automatically check the visitors browserlanguage (basically on starting the session) and set it as default (if not german -> english) BUT keep open the possibility to do a manual switch. my first very, very simple piece of code (which terribly failed) looked like this (in my header template) if(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2) != 'de') { $user->language = $languages->get('en'); } now i know what the problem is (my header.inc gets included everytime and does this request even after a switch), but cant make my mind up about a proper solution... i also didnt find something about this very specific problem by using the search, but am really grateful about any advice best, overoon
-
Hi everyone, I'm currently setting up my first multilingual project on a brand new 2.4 install. One of the things I tried to find out is how to change the default language. Fortunately I'm not the first one and I found good solutions. While reading through a lot of stuff I stumbled upon the suggestion to change the language of the guest user here and here. So I tried that and always get the error: "The guest role is required". Despite the error the language change gets saved. Two other users also reported this here and here. Like Relmos reports, after switching the guest user language, my site also displays in the default language. I checked with <?php echo $user->language->name; ?> in Chrome Incognito mode. This raises 2 questions: 1. Is setting the guest user language really affecting the language displayed on the home page or is it only determined by what language I set the default language to (like explained here)? 2. Can anybody reproduce the error message when switching language of guest user and what does it mean? The guest role is still there after switching. So I don't quite understand the meaning of that error message. Patiently awaiting partial enlightenment through this great community gerhard