Leaderboard
Popular Content
Showing content with the highest reputation on 10/01/2019 in all areas
-
@ryan, would you consider adding the ability for PW to split database connections for read and write? I think it will be really useful, especially for high-traffic sites. Something like this (https://laravel.com/docs/master/database#using-multiple-database-connections) or WordPress HyperDB (https://wordpress.org/plugins/hyperdb/) Thanks Rudy2 points
-
First things first. Look into your field settings if there is a (new) limit set and also check your php.info for these two option: upload_max_filesize = 20M post_max_size = 20M2 points
-
Are all your modules up to date and compatible with ProcessWire 3.x? You can clear the compiled files cache - can be found at the bottom of your module page - and try again.2 points
-
The module itself is more like a toolkit. It looks for a cookie to show/hide the banner and sets value(s) depending on the user's choice and your settings. Based on that decision and your settings you can build up your more complex logic if needed. if(localStorage.getItem('pwcmbAllowCookies') == 'y') Source: http://modules.processwire.com/modules/cookie-management-banner/ That snippet allows you to trigger/load Matomo, Google Analytics, Tag Manager, Amazon, whatever. Play around with the module and keep an eye on all the cookies/localStorage values and when they get set. So... coming back to your question: if the user neither allows, nor denies cookies the module does almost nothing. There is an option to autofire/allow cookies/track visitors but at the end you always decide what happens in which case. You could build something like this: https://github.com/webmanufaktur/CookieManagementBanner/blob/master/assets/html/CookieManagementBanner.OptInOut.html2 points
-
Sounds like you could use LazyCron here. Check your pages how often you want (daily, weekly, each hour), look for those pages and do what ever you want to do with them. Put things like this in ready.php or create a module: <?php namespace ProcessWire; wire()->addHookAfter('LazyCron::every6Hours', function (HookEvent $e) { $pagesOlderThirtyDays = $e->pages->findMany("template=order, ... "); foreach ($pagesOlderThirtyDays as $potd) { // WHATEVER YOU WANT }; });2 points
-
Just to share an accidental discovery. I've just stumbled upon this website: https://getpublii.com2 points
-
Yes, you will get it like with this code: $out = new \stdClass(); $out->clients = []; foreach([0=>['id'=>'abc'], 1=>['id'=>'xyz']] as $client) { $out->clients[] = $client; } header('Content-Type: application/json'); echo json_encode($out); see: https://www.php.net/manual/en/language.types.object.php#1186791 point
-
I believe you are right. I was looking at a file and completely missed that the output was supposed to look like the following: { "clients": [ { "id":1644, "code":"abc", "name":"Test Name", "associated_users":null, "url":"\/pw\/clients\/abc\/" }, { "id": 1645, "code": "xyz", "name": "Test Name", "associated_users": null, "url": "\/pw\/clients\/xyz\/" }, ] }1 point
-
I believe this would result in erroneous JSON syntax. Your 'clients' need to be a (key or property) element of either an object or an array, not a preceding string.1 point
-
Does it still persist if you delete the contents of site/assets/cache/FileCompiler?1 point
-
Adding a /*NoCompile*/ FileCompiler hint as explained here should solve the issue (and let you keep FileCompiler active).1 point
-
You can just change $page->template->contentType and $page->template->altFilename at runtime… $html = $page->render(); $page->template->contentType = 'txt'; $page->template->altFilename = "Mail.txt.php"; $txt = $page->render(); $count = $this->mail->new() ->subject($subject) ->body($txt) ->bodyHTML($html) ->send(); For me, altFilename actually is enough…1 point
-
1 point
-
I don't think Ryan will read this. You would have more luck if you create a request on Github.1 point
-
Another survey I stumbled upon yesterday: https://www.gwhitworth.com/surveys/controls-components/1 point
-
Looks interesting, thanks for sharing! I put it on my todo list to take a closer look. Interestingly, I have just recently set up a workflow based on CodeKit and its "Kit" file compiling capabilities (Kit == HTML + import features + variables) in order to craft my own site. I boosted the whole thing by also adding Fat-Free PHP to the mix. I use Beyond Compare for syncing to the server. All this is about producing "flat files". Since I also sprinkle PHP here-and-there, I actually invented my own Semi Flat File website approach ? My whole setup is all about using desktop GUI apps, as opposed to (say) npm based cli stuff which can be quite unreliable at times (actually, unreliable too frequently to my liking). All in all, what I like about Publii is that it is a "technically minded" / developer oriented solution, still, components are integrated as a desktop app, so there is no need to experience the pain of npm/webpack/and-similar as all the burden of such things are on the developers of Publiit, and not on the developer of the website(s). After all, I'm a creative guy who likes to create, but I dislike dealing with fixing CLI tools, fighting incompatibility issues and such. That is why I chose ProcessWire in the first place, btw. ?1 point
-
I guess this is a bit of a chicken and egg problem. The admin in processwire is hardly anything special based on what the core knows about it. It's a bunch of pages, which just happens to be tightly access controlled and forwarding their handling to process modules instead of rendering templates. So before knowing the page you're on there's not really a good way to know if the request is going to serve an "admin page" or not. To query the current page a lot of things already need to be started, and I guess you want to hook into those before any pages are queried, at best by already knowing the context, which is not going to work. A good example is the function you've shown in your initial post. It's a good heuristic for determining if the user is in the admin, but also not bullet prove, as there can be normal pages as children of $this->config->adminRootPageID as well. It might rarely happen, but it's possible. The only way to be sure is actually having $page queried.1 point
-
Hi Teppo, is there a way to make the search language aware? - I mean getting the right context from mutilanguage fields per active language? Probably this would mean an indexing per language? If not, I wonder if at least all language text entries from a multi language field get indexed? - so a search in the non default language might find maybe too much, but not too little?1 point
-
Actually I came to a pretty handy solution with my co-dev! Images have information about their modification time saved within them, so using that I came up with following code: $img = $page->image; // check if image exists if($img) { // fetch cropped images' modification timestamps $tsNormal = filemtime($img->getCrop('normaali')->filename); $tsHigh = filemtime($img->getCrop('korkeampi')->filename); $tsLow = filemtime($img->getCrop('matalampi')->filename); // check if they have the same modification time => user hasn't cropped the image, so use the original if(!($tsNormal == $tsHigh && $tsNormal == $tsLow)) { // stamps are not equal => check which is highest aka last modified switch(max($tsNormal, $tsHigh, $tsLow)) { case $tsNormal: $img = $img->getCrop('normaali'); break; case $tsHigh: $img = $img->getCrop('korkeampi'); break; case $tsLow: $img = $img->getCrop('matalampi'); break; } } } Seems to work quite nicely for my purpose ?Thought it would be nice to share, if anybody else wants to achieve similar effect!1 point
-
*pops head up* I seem to be getting a few more ecommerce enquiries nowadays so happy to test when you're at that stage.1 point
-
Good morning! AdminBar 2.3.0 was just released. Here's the changelog for this version: ## [2.3.0] - 2019-08-29 ### Added - Gravatar image support for the "user" item in Admin Bar. - Support for sorting Admin Bar items manually with the AsmSelect field in module config. - A changelog file. ### Changed - Protect logout link from accidental clicks (script or otherwise) by converting simple link to a logout form. - When modal window is opened, hide children and view tabs with CSS first in order to prevent flashing content. Due to the manual sorting feature mentioned above there was a change in the data structure, so note that if you're already running AdminBar and have modified the visible items in the bar, you'll need to reconfigure those. This was the easiest way I could figure out to achieve free sorting feature: Minor note: currently it's possible to add the same item to both left and right columns. I didn't see a reason to specifically prevent this, so it's kind of a feature – though not sure if that's something you should ever do from a UI/UX perspective ?1 point
-
Thanks for your help @Zeka I managed to get both hooks working after a bit of debugging. $this->addHookAfter("ProcessField::buildEditFormBasics", function(HookEvent $event) { $f = $event->object->getField(); if($f->hasFieldtype !== false) { $field = wire('modules')->get('InputfieldTextarea'); $field->attr('name', 'helpTipContent'); $field->attr('value', $f->helpTipContent); $field->collapsed = $f->helpTipContent ? false : true; $field->label = __('Help tip content'); $field->description = __('Enter the help tip content that will appear in the tool tip.'); $event->return->append($field); } }); // inject our markup fields into the form right after the source elements $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->return; $page = $this->process->getPage(); foreach($form->fields as $f) { $content = $f->helpTipContent; if($content) { $_field = $form->get($f->name); if($_field->id) { // add hidden field with tooltip content $field = wire('modules')->get('InputfieldMarkup'); $field->attr('name', 'toolTipContent'); $field->attr('value', $content); $field->skipLabel = true; $form->insertAfter($field, $_field); } } } });1 point