Jump to content

Marcel Stäheli

Members
  • Posts

    56
  • Joined

  • Last visited

Everything posted by Marcel Stäheli

  1. @Zeka I forgot to answer, sorry. I solved the first problem: On pages with the same page name in both languages, I only entered a page name in the default language. Normally PW falls back to that name if no name is entered in another language. However if you use localName it doesn't. I just had to enter the same page name in both languages. Second problem: I couldn't get your code to work (I fixed the ')' instead of the '}' ). Something is wrong so I just tried to do it without checking if the tag exists. But I can't get that to work either: $articles = $pages->find("template=article,tag_select=$tagName"); This is supposed to find any article page where the multi-page reference field contains a page with the name $tagName in any language, right? It works only with the default language. As soon as I switch the language, no results. The only tags where I get results are the ones that have the same name in both languages. Since tag_select is a page-reference field, is it the same problem as before? If you search for pages with a certain name it only searches in the default language? If so, how could I search for say page titles within the page reference field?
  2. @Zeka Thanks for testing it. I was not precise enough. It works with the default language German. But when I switch to English the query string of a page with the same name in both languages is &tag=. Did you check in both languages? Second question: It is meant as a security check. I noticed that should someone enter a query string manually like &tag=a I get all kinds of pages listed. So I make sure that the tag actually exists. There are probably better ways to do this. But I would still be interested to know what would be the easiest way to use find() to search for name-field values in the current language?
  3. Hello if have a few article pages that have a multi-page reference field with tags about the content of the article. All tags of a given page are displayed and link to a tag-overview page. Every link has a query string added with the tag name like &tag=cars so that I know which articles have to be displayed on the tag-overview page, The tag name is created using $tag->name. Since the website is multi language using German (default) and English, I use $page->localName($language) to get the localized page name . The code looks like this: foreach($tags as $tag) { $tagsMarkup .= "<a href='" . wire('pages')->get('/tags-overview/')->url . "?tag=" . $tag->localName(wire('user')->language) . "'>" . $tag->title . "</a>, "; } The code works mostly fine, but when a page has the same name in both languages, the query string will have no value just ?tag=. Why? A second problem that might be tied to the first: Once on that tags-overview page, I check if the tag actually exists using: $allTags = $pages->get("/tags/")->children); if($allTags->has("name=$tag") {...} But as I read on the forum (https://processwire.com/talk/topic/2979-multi-language-page-names-urls/?page=6) that only checks for name in the default language. It was suggested to use $page->parent->path . "pageNameEnglish" but I'm not sure where and how to use it in my case. Any help?
  4. I added some fields to the user template. Among them is a single select field named "country" with a few country names in english and german. If logged in, the user has access to his profil page on the frontend where the fields that he is allowed to change are displayed in a form using the form API. I want to populate the select field with the same options as the field has in the backend. But I can't get it to work: //Getting all Options $fieldCountry = $fields->get('country'); $all_options = $fieldCountry->type->getOptions($fieldCountry)->getValues(); //Creating the field $field = $modules->get("InputfieldSelect"); $field->label = _("Country"); $field->addOptions($all_options); $field->set('initValue', $user->country->title); $form->append($field); Something about the selector for the options is wrong. I got the code from the Select Option Fieltype Page but it didn't work with $field->addOptions(). So I added ->getArray() myself. Now I have a dropdown list on the front end but it's just the numbers instead of the country names. Also I would like the currently chosen country to be the preselected option, So when the form gets saved without any new input, the country doesn't change. How would I do that? My code doesn't work.
  5. I'm nor sure anymore how that admintheme error happend, I think i read an outdated thread on how to customzite it. I copied the AdminTheme Folders from a diffrent project where everything was fine. Still had the problem, then I copied the \wire\templates-admin folder, and that did the trick.Everything is back to normal. Lesson: Never mess with the wire folder. Thanks, I don't think I would have tried that without your input.
  6. Hello everybody I'm running xampp 3.2.2 and I created a website using the ProcessWire 3.0.39 build that I plan to use as a foundation for future projects. I exported the site using the "Export Profil Site" (as i have many times before with other sites). I installed the site-profil as a new site with the processwire built 3.0.42. The installation itself goes smoothly without errors when I try to login I get an AdminTheme Reno Error which I can resolve by deleting the AdminTheme Reno Folder under \wire\modules\AdminTheme. I don't think that's the cause of my problem because I had that error with other sites that worked just fine after installation ( I screwed something up with the admintheme on a previous version of the site). So after I logged in everything looks normal, except the dropdowns of the Main Menu (Pages, Setup, Modules, Access ...) don't work anymore, when I hover over them they change color, but no submenu appears. Also I'm missing the "Save"-Button on the top right of any Edit-Page. The "Save"-Button on the bottom left is there and works. Everything else functions as normal too (as far as I can tell). Its not the Processwire Built, if i install one of the standard profils the submenu appear and the "Save"-Button is there. It seems the fault is with my site-profil, but I have no idea what could cause this problem. Any ideas?
  7. Thanks for the reply. I read about that in another post but never tried it because I thought it was a diffrent problem than mine, i was wrong. I tried it now and the loadtime for my speedtest page dropped to 250ms, but much better than before. Thank you
  8. Hello everybody I worked on a website locally on my laptop using xampp and then exported it to our production server. But here the loadtime suddently is about 1.2 seconds longer than before. It doesn't matter how complex or simple the page is, there is always at leastt 1.2s wait time before the browser receives the first page-data (more complex site have aboout 2s). I did a processwire testpage with just 1 line of html-text hardcoded in the template file, no php or database calls and it still has the delay. speedtest.php: <!DOCTYPE html> <html> <head> </head> <body> <main> <h1>hardcoded: speedtest</h1> </main> </body> </html> Now if i move that template page outside of the processwire folder and access it in a browser it displays with no noticable delay. As it should. Could it have something to do with an ip4/ip6 conflict? I ready some users had problems on a windows machine when using localhost, but it's not quite what i'm experiencing. Any idea on where to look for the problem? Anybody had any expiriences like that? I don't even know how to go about diagnosing the problem. Production Server: Microsoft IIS 8.5 PHP 5.6.04 Server API: CGI/FastCGI Processwire: 2.6.1 Any help or suggestion is greatly appreciated.
×
×
  • Create New...