Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. I have it in site/ready.php and works just fine.
  2. Why have code that executes on every request and saves everything? This works just fine $this->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->arguments("page"); if(!($page->template->id == 89 && $page->parent->parent->id == 11180)) return; $repeaters = $page->pro_table; if(!$repeaters->count) return; $total = 0; foreach($repeaters as $rep) { $rep->row_total = $rep->days * $rep->day_rate; $total += $rep->row_total; if($repeaters->last === $rep || $repeaters->count == 1){ $rep->row_total = $total; } } });
  3. That script doesn't have anything to do with PW and its installer, it just downloads the files.
  4. $page = $event->object->getPage(); in a Pages::saveReady $event->object would be Pages not the page getting saved. You'd use $event->arguments("page") to get the argument variable "$page" from the ___saveReady() hook in Pages. or $event->arguments(0) to get the first argument variable which would also be the "$page", but I prefer the named version.
  5. Some installed the System Notifications core module, and now I can't deinstall it. Anyone an idea how to proceed? When I deinstall the module it's deinstalled, but then the Error is shown that the FieldtypeNotifications requires the module. But I can't remove the field "notifications" and deinstall it. I have advanced modus on and when I remove the permanent and system flag on the field I still can't remove it from the user template, though it says it has done it. Once the System Notifications module is deinstalled I also can't edit the field anymore as it requires the module and I see a "no output". When I deinstall the SystemNotifications module it even says that this will deinstall the FieldtypeNofications, but it can't obviously. A complete mess. Edit: I have no idea after many several tries to deinstall and remove, it deinstalled 2-3 times with some errors of duplicate entries about the notifications field and now it's finally gone. No idea what happened.
  6. Soma

    Centura

    Sure, very offending... but nothing for me to select, so I simply leave. ?
  7. Soma

    Centura

    I can't enter the site, cause I'm swiss and there's no language and Region listed for me. Shame.
  8. What are you trying to find? Tulokset ? Hakutulokset? Is also not found on google maps... Otherwise i can find all addresses i can think of, it's quite a good alternative.
  9. 20+ year of web dev and we still on this bs. Best thing that happened is: box-sizing: border-box; Jees, we fly to the mars...
  10. Assuming you use TemplateFile ? This works as it should, variables are passed as is: $tpl = new TemplateFile("_tpl.php"); $tpl->myVar1 = 0; $tpl->set("myVar2", 1); $content .= $tpl->render(); in _tpl.php echo $myVar1; echo $myVar2; Outputs: 01
  11. I could reproduce it. Just am on a new project and isntalled blank 3.0.98. It doesn't happen always. Can you open an issue on github please. Thx.
  12. That's true, thanks for mention it. But Autojoin can also be counter productive/ make things worse.
  13. You haven't heard but it's there, we've been there. It's some weak point of PW. A template with 50 fields and you output the data you end up having 50+ queries just for one page. Every echo $page->yourfield does a DB query. If you list or render other data from other pages etc, you can easily have 200+ queries just for one page. It doesn't all scale well especially with lots of fields and stuff going on. Add with heavy traffic and you end up in performance problems very fast for a complex site (PHP & mySQL not being the fastest). Caching is one thing, but sometimes you can't cache everything, because you have logged in users etc. Edit: Just because you haven't heard, doesn't mean it's not there. Ryan also sometimes has this misconception, that if he doesn't know/hear about it, it's not existent. Most people don't always tell, they just move on. ?
  14. You need to set the type of the repeater matrix.... ie: $new->repeater_matrix_type = 1; and save the item before adding files. And you don't need to add the new item to the field after that, it's already added.
  15. This is the shortest method using implode(): if($page->authors->count) echo $page->authors->implode("; ", "<a href='{url}'>{title}</a>") . ".";
  16. No idea. What module and version are you using? And btw /xxx is not a page name. Also PW uses trailing slash (default).
  17. It actually only adds active to the active nav item. All parents of the active nav items get "parent". The first options in MSN. https://github.com/somatonic/MarkupSimpleNavigation#same-with-comments $options = array( 'parent_class' => 'parent', // overwrite class name for current parent levels
  18. You would just have to find out if your on "Solutions", then use that (the current page) as the root for the MSN. SO it renders only children of Solutions. You can get the level you're on also by using $page->parents->count which Would be 1 for Solutions, 2 for Solutions Overview. So there's no options to do what you want, you'd have to find out the condition via some logik and then simply use another root parent page.
  19. All nice and I know there's ways to get around it, but the Site has no content to crawl, just empty html. And if JS is not enabled you see this: "This is your fallback content in case JavaScript fails to load."
  20. I think Tom is right. Inputfield render is the inputfield markup not the whole <html>. Why not just use the core scripts array? $this->wire("config")->scripts->add("/xxx/xxx.js");
  21. I think this is by design to optimize queries. But not sure. It uses COUNT in SQL to evaluate children counts which don't check for page status, I can imagine on very large sets it could get slow? Anyway this case is rare you really need this and have access aware. What is your use case exactly? You can always just loop the pages in question and check for $page->numChildren(true) which is access aware. (You could also store/cache that info in a real field on the page with some hooks and use that.) Some example with numChildren() $res = $pages->find("template=basic-page"); foreach($res as $r){ $r->has_children = $r->numChildren(true) > 1 ? "true" : "false" ; } echo " | has children: " . $res->find("has_children=true"); echo " | no children: " . $res->find("has_children=false");
  22. Maybe just use this module? https://modules.processwire.com/modules/textformatter-video-embed/
  23. It's not a bulk redirection of all to home... RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} All urls redirect to its same url just https. Your code doesn't work and doesn't make sense here at all cause you redirect /about to /about to /about to /about to /about .....
×
×
  • Create New...