Jump to content

Tiberium

Members
  • Posts

    48
  • Joined

  • Last visited

Recent Profile Visitors

1,815 profile views

Tiberium's Achievements

Full Member

Full Member (4/6)

41

Reputation

  1. So funny, I was yesterday reading the RockFrontend Docs and planned a little project to test this out ^^
  2. But Cursor is a (VS-Code like) editor. Not something you can integrate in your editor of choice (as a plugin), correct?
  3. @poljpocket We also use ACEEPT-LANGUAGE for it, see here: But we also make sure, that Bots like Google are not affected by it.
  4. We choose also via language, not country. In the end, it is important what the user speaks, not where it lives (in the case of most of our customers). For automatic redirects, we also use only the first two letters of the browser sended Language code. The language itself. As by example of switzerland: de-ch, it-ch or fr-ch. You see that the language came first. For you I would ask, is that a site who will have special/other content depending on the country (because other products or other prices) or will 99% the same content, but then in the other's language? Is it the first, then you should separate it like poljpocket suggested and consider there multi language approach, if that make sense for that country. Is it the second case, then you should primary focus on the language
  5. The script is in my templates/init.php file. You have to change the switch statement. Change zh to pt and replace de with es. You need to put google on an exclusion list, so the bot get's not redirected! That is important, because the bot will visit with "en" language and will kick out all other language out of the index, if you force a redirect on them. The redirect function: function crawlerDetect($USER_AGENT){ # Bots we DON'T want to redirected $crawlers = array( 'Google' => 'Google', 'Lighthouse' => 'Chrome-Lighthouse', 'MSN' => 'msnbot', 'Rambler' => 'Rambler', 'Yahoo' => 'Yahoo', 'AbachoBOT' => 'AbachoBOT', 'accoona' => 'Accoona', 'AcoiRobot' => 'AcoiRobot', 'ASPSeek' => 'ASPSeek', 'CrocCrawler' => 'CrocCrawler', 'Dumbot' => 'Dumbot', 'FAST-WebCrawler' => 'FAST-WebCrawler', 'GeonaBot' => 'GeonaBot', 'Gigabot' => 'Gigabot', 'Lycos spider' => 'Lycos', 'MSRBOT' => 'MSRBOT', 'Altavista robot' => 'Scooter', 'AltaVista robot' => 'Altavista', 'ID-Search Bot' => 'IDBot', 'eStyle Bot' => 'eStyle', 'Scrubby robot' => 'Scrubby', 'Facebook' => 'facebookexternalhit', ); $crawlers_agents = implode('|',$crawlers); if (strpos($crawlers_agents, $USER_AGENT) === false) return false; else { return TRUE; } } # The setLang var is that for the hole session it will not enforce the redirect anymore # I have in the footer of my sites a language dropdown as override in case the user want to visit the # other language - or in case the automatic ist wrong $USER_AGENT = $_SERVER['HTTP_USER_AGENT']; if(crawlerDetect($USER_AGENT)) { $session->set('setLang','1'); }; if(!$session->get('setLang')) { if ($_SERVER['HTTP_ACCEPT_LANGUAGE'] != '') { # I take the first two letters of the sended language and compare it in a switch # statement $accept_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); switch ($accept_lang) { case 'de': $session->set('setLang','1'); if($page->url != "/") { $url = $page->localUrl('default'); $session->redirect($url); } break; case 'en': $session->set('setLang','1'); if($page->url != "/en/") { $url = $page->localUrl('en'); $session->redirect($url); } break; case 'zh': $session->set('setLang','1'); if($page->url != "/zh-cn/") { $url = $page->localUrl('zh-cn'); $session->redirect($url); } break; default: $session->set('setLang','1'); if($page->url != "/en/") { $url = $page->localUrl('en'); $session->redirect($url); } break; } } else { $session->set('setLang','1'); } }; The dropdown (is building also in the templates/init.php above the redirect function) - also make here the same changes as above, case 'default' to es (your base language set in ProcessWire and zh to pt, and the default case in the bottom to en, as the wish fallback: $current_lang = $languages->getLanguage(); switch ($current_lang->name) { # set all placeholder variable for the users language # also the attribute then for the html tag case 'default': $class_lang = 'language-de-de'; $hreflang = 'de'; $lang_url = $wire->page->localUrl("default"); break; case 'en': $class_lang = ''; $hreflang = 'en'; $lang_url = $wire->page->localUrl("en"); break; case 'zh-cn': $class_lang = ''; $hreflang = 'zh-cn'; $lang_url = $wire->page->localUrl("zh-cn"); break; default: $class_lang = 'language-de-de'; $hreflang = 'de'; $lang_url = $wire->page->localUrl("default"); break; } # The Dropwdon Linkt Text as PRocessWire Language Var, that can be set in the language module $drop_title = __("Sprache ändern"); $lang_li = ''; foreach($languages as $language) { // if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { $lang_li .= "<li class='current'>"; } else { $lang_li .= "<li>"; $url = $wire->page->localUrl($language); $hreflang_drop = $home->getLanguageValue($language, 'name'); $lang_li .= "<a class='drop-item' hreflang='$hreflang_drop' href='$url'>$language->title</a></li>"; } } # Now comes the dropdonw. Build at with the framework/dropdown lib you want and change it accordingly. $drop_title for the titel of the menu # and then $lang_li for all the collect <li> above $lang_dropdown = ' <div class="dropdown"> <button class="drop-toggle" type="button" aria-expanded="false" onclick="dropFunc()"> <svg width="18px" height="18px" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="#fff" style="transform: translate(0, 3px);"><path d="M2 5H9M16 5H13.5M9 5L13.5 5M9 5V3M13.5 5C12.6795 7.73513 10.9612 10.3206 9 12.5929M4 17.5C5.58541 16.1411 7.376 14.4744 9 12.5929M9 12.5929C8 11.5 6.4 9.3 6 8.5M9 12.5929L12 15.5" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M13.5 21L14.6429 18M21.5 21L20.3571 18M14.6429 18L17.5 10.5L20.3571 18M14.6429 18H20.3571" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg> '. $drop_title .' </button> <ul id="drop-menu" class="drop-menu"> '. $lang_li .' </ul> </div> '; Then in my templates/_main.php in the footer, I call $lang_dropdown for the dropdown menu for manual override.
  6. But i need the heat for this cold days ^^ For real: Thx for the info and update notification!
  7. The comment is valid. What you struggle with, is a basic using of the PHP language, not ProcessWire itself. That is also not a bad thing, I personally started learning PHP with ProcessWire. A PHP Tutorial that explains the basic things with examples close to easy HTML together can be a starting point. Or looking at the Code of the basic profile as you did and then research the things who are unclear with the PHP documentation. Gideons link is also a good starting point. Your last sentence is also not productive. There was no bad intention in the post before. This community here is an example of the opposite.
  8. It's interesting to see a confirmation of my testing (codium vs Supermaven). Especial the inline Autocomplete function. What I mostly use. The context window now with 1 mio, is a fresh update from 02.07.
  9. yes to be more precise, it is aware of the edited files it was active. The chat index the whole project (you can see the progress on it). But Supermaven seems to had context in inline autocomplete of files i didn't touch (but they are in my project).
  10. @MarkE Are you planning to released it, or is it a more specific develop for your needs?
  11. I test supermaven and codeium at the moment. What I like about supermaven, it is superfast. I don't develop that "Copilot pause" on my typing. Codium feels slower as supermaven, but also faster as Copilot. On codeium, my problem is, that the context of the project is only avaible in the chat, not really in the inline mode (in my testing). So that is something, where I tend more to supermaven at the moment. (Maybe it is a limitation of the neovim plugin)
  12. In this case, i would deactivate the session cookie completely. Here is an example for a solution, that keep it for logged-in users, but don't set it for guests: https://processwire.com/talk/topic/15270-session-storage-and-lifetime/?do=findComment&comment=136575
  13. It is a (normal core) Repeater in a RepeaterMatrix (ProField). The repeater itself is working without depth: Only the content of the normal core repeater is affected (in red). It is a module of my own. I use it to help my coworkers to set some fields in one place. It doesn't touch the repeater field or any field that is in the repeater. It also does not add/remove fields. The only logic in it is to write field content in destined fields.
  14. I'm through all trash sites. There are 2 template type in it. One is text-template and the second one from a custom module. The latter are three pages. The text template pages, have all the RepeaterMatrix block field, but not all have the problematic repeater field in it. And no of the trash pages hold in their repeater field the content of the non-trashed pages. Maybe an image is here better, in comparing of my language skill ^^ That image show how it looks before I empty the trash. After that, everything in the red square are gone. All repeater items are completely deleted. Doesn't matter if is 2 or 9.
×
×
  • Create New...