Jump to content

Tiberium

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Tiberium

  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.
  15. I'm facing a crazy problem. When I'm emptying the trash of a site from my customer, then all the content of a repeater, on all pages gets deleted. There are ~30 pages in the trash. All of them looking like Standard Text template pages. There is no repeater template page in the trash, from what I see. The only special behaviour is, that the process of empty the trash takes very long. After I realized that all repeater content are gone, that makes sense for me. How can I check which pages in the trash are maybe the reason for that, and how can I isolate that and "clean up the mess"? And what can I do, to prevent this in the future? Some context: The repeater have a TinyMCE, a "normal" textline-field and an image-field. The repeater is self placed in a RepeaterMatrix field. That latter is unaffected, and it happens on two separated RepeaterMatrix selection, so I don't think that is the root of the problem. (Discloser: I don't have support on it anymore)
  16. @ryanIf I may: I have a system that allow to add a Bot Alias to a Discord-Bot for a rpg chat group. The bots later are trigger in discord by a choose nickname. By near 80 players, some names are not unique. So I want to give a moderator the option to give manual a nick for the bot alias. For that, it would be nice to have a unique text field. Also, i "connect" the forum with it. So a moderator can add the forum-id's to a character. Here would it be also nice as a protection to not post the same ID twice, that an integer field has the option to be unique.
  17. Yes that is what i mean. But the Analytic code is not loaded until the user is accepting the cookie. In this time, the Cookie Banner is loaded without the Google code and the "above the fold" content is also loaded without it. The Google code should be there 2-5 rows (w/o compression) as Plain-Text, but not as processed code from the browser. So there was no "loading". When the GoogleAnalytic Code is written in the FrontEnd files, there is also no ProcessWire field, who was/wasn't loaded it. So no database interaction, no server process time used for it. And not process by the browser until the cookie banner give the signal. If the GoogleAnalytic Code comes completely from a module and is not self wrote in the source code, then yes, the loading of the site trigger the module to load the GoogleAnalytic code (not the trigger itself), but the loading "delay" can be prevented with the template-cache again. The "loading" part are 5(?) rows of plain-text, what the browser is not interacted with, until the cookie banner say so. When you use PageSpeed, 90% of the performance problems are bad compressed image, not lazy loading (what is more or less what you describe!) and using of wrong technics (like not optimized above the fold content).
  18. For me, that is optimizing "above the fold content" and delay/lazy loading after that. So the first impression is fast and everything else the user is not seeing is loading in the background or when the user is near to it. For the fields loading... i use (template-) cache on potential landing page such as the homepage/start page. So I doubt it would benefit performance when (ProcessWire-) fields are selective loaded. Even more when you go the ProCache route. For the user, it is more important what you do via the FrontEnd code with it. How you handle defer/lazy loading and co. For GoogleAnalytics, here in the EU, you need conformation of the user, before you transfer data to Google. So it does not trigger until the user accept it. So I look that my cookie banner is using CriticalCSS (The css rules in the style tag in the document's head) as also elements where are "above the fold". Everything else is coming after that and the user don't have to wait for elements to load, they direct can see in the beginning. PageSpeed/Lighthouse (https://pagespeed.web.dev/) is testing this and give indication, where you can optimize.
  19. @erikvanberkumLook about the $config->sessionFingerprint options. To set in the /site/config.php file.
  20. Jep Firefox is looking automatic for a favicon file if it is not provided in <head> section.
  21. I tried jan, it is interesting, because it allows you to use different LLM (also the OpenAI ones). I use Mistral Instruction 7B Q4 for this: (The code blocks have a copy to clipboard button on hover, so you get it fast to an editor of your choice... )
  22. Any plans to switch to the maintained fork: https://github.com/adminerevo/adminerevo ?
  23. On "natural" textfields, processwire don't add anything. The Rich Text editor like TinyMCE add code, because it is in the end a WYSIWYG-Editor. But as an example, when the first line of my TinyMCE field is a headline, it doesn't add a p-Tag before this. It begins with the headline tag. As it should. And even not add any p-tag when the headline is the only thing in my textbox. HannaCode add a p-Tag around the output, you can deactivate this behaviour on the edit dialogue of the HannaCode self. Aside from the option above, a autoclose behaviour can come from TinyMCE or from your browser, when it thinks a p-tag is open but should be closed, before a block-element (like div's).
  24. On Android I can replicate the error with the share of the kollar site in WhatsApp. But not on other sites were also using jpeg (also with e). Maybe the point in the filename irritated android?
×
×
  • Create New...