Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. If you set an explicit protocol on the template, $page->httpUrl() will return correct https if set. $input->httpUrl(true); Will return the full requested url with protocol and query string / url segments.
  2. Ever tried: $page->editUrl(true);
  3. There's no group by feature in PW. WireArray->unique() doesn't work for this purpose. Using the API you could Just build an array using WireArray->explode() and use array_unique(). Depending how large the result set is you could cache the array so it only builds the array when it expires or based on a selector. $uniquedates = $cache->get("uniquedates", "template=basic-page", function(){ return array_unique(wire("pages")->find("template=basic-page, sort=date")->explode("date")); }); print_r($uniquedates); If the amount of entries is very large and it would take several seconds to build the array, it could make sense to use something like direct SQL query.
  4. Also I wouldn't use "$files" as that is a PW template variable. https://processwire.com/api/ref/files/
  5. $name = str_replace("_", "", $file->name);
  6. I'm not sure I can follow you. What cache are you using then? PW template cache can be cleared in the core module "PageRender"
  7. Thanks @adrian I think I got it sorted out. New version 1.0.4 is pushed.
  8. Why not just use the Page reference Autocomplete?
  9. I guess you have to prevent the redirect for your download template? So don't redirect if template is xy I guess? Or not include it in the first place?
  10. It's not as easy. This can lead to all sorts of problems as you only change the template var $page and it may work for simple cases. But PW already has set and loaded the requested page internally at this point and other code (in templates, modules etc) may not work correct as they will still ”see" the other page.
  11. I have it in site/ready.php and works just fine.
  12. 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; } } });
  13. That script doesn't have anything to do with PW and its installer, it just downloads the files.
  14. $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.
  15. 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.
  16. Soma

    Centura

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

    Centura

    I can't enter the site, cause I'm swiss and there's no language and Region listed for me. Shame.
  18. It's not an error but a notice. ?
  19. 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.
  20. 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...
  21. 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
  22. 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.
  23. That's true, thanks for mention it. But Autojoin can also be counter productive/ make things worse.
  24. 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. ?
  25. 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.
×
×
  • Create New...