Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. I'm not using it for global layout, but sometimes for micro positioning or e.g. places, where boxes should be of equal height. So the things which could break without affecting functionality, but rather aestetics.
  2. It can, but depending on the use case it might not be a fit. E.g. it's not suited for parallel processing of items.
  3. Queues are quite simple. Store a message in some kind of database (at best one build for this usage) and some other process does later read the message and execute something based on those messages. Those reading processes are often called workers and either run continuously (deamon) or are started in intervals (cron) or manually, which is always an option
  4. Pagefields afaik are always unique in that they cannot hold a page multiple times. But enforcing the number of items is not possible. Personally I code such things to allow for 0-6 items in my template and just add a note to the field that it'll look bad without at least 4 items and that every access item after the first 6 will not be shown.
  5. Has anyone tried p:empty{ display:none; }?
  6. Depending on which method of adding the frontend editing you're using you migh need to specify the field and the pageid: https://processwire.com/blog/posts/front-end-editing-now-in-processwire-3.0-alpha-4/
  7. I've had similar issues in the past, but not anymore for at least the last year or so.
  8. You can do that, but there's no way to detect this automagically. You'd need to define this connection either in code or even in the data layer by using e.g. a pagefield to link pages to their appearance-pages (if different).
  9. Glad to hear that. If some of you guys are using it I'd really like to hear your thoughts or issues.
  10. I don't like the one line syntax, because I'd need to explicitly 'use' all variables declared somewhere else in the template, so they are available in the anonymous function. And secondly it's not possible to add the things I added above without recreating the whole get() function in a hook.
  11. For those interested, do not buy it in a rush. I've the previous issue at home now.
  12. WireCache is a really nice way to quickly cache data to the database, but when working with json data there are some quirks. Imagine the following examples: $data = $cache->get('my-key', WireCache::expireHourly); if(!$data){ $data = […] $cache->save('my-key', $data, WireCache::expireHourly); } // API response $response = json_decode($data); $image = $response->data[0]->image; // or $html = "<div data-json='$data'></div>"; Both should work from the quick look. Both will fail as soon as the cache kicks in. This is because the implementation of WireCache tries to be smart and does automatically decode data, which is detected to be json. But it doesn't just decode it like in my example, but rather uses json_decode()'s second parameter to decode the json as associative array(s) instead of stdobject(s). If you prefer the object syntay to traverse your json data or you really want to store raw json, then I've got two hooks for you, which do prevent the automatic json detection of WireCache, so you can work with the stringified json as you need to. Just replace the get() and save() calls in the example with getRaw() and saveRaw(). $wire->addHook('WireCache::saveRaw', function(HookEvent $event){ $args = $event->arguments(); $args[1] = '::RAW::' . $args[1]; return $event->return = call_user_func_array([$event->object, 'save'], $args); }); $wire->addHook('WireCache::getRaw', function(HookEvent $event){ $args = $event->arguments(); return $event->return = str_replace('::RAW::', '', call_user_func_array([$event->object, 'get'], $args)); });
  13. $wire and ProcessWire/wire() return the exact same object, but $wire is only available in template/bootstrap context. Depending on where you're trying to use wire() it might get compiled and should work as before.
  14. I've exactly the point to make as adrian. The whole frontend design part might get easier, but only for the simple content (some images, some text). Anythings remotely related to a larger set of data will probably not be handled by those sites anytime soon.
  15. I've just added the module to the modules directory. As soon as it's reviewed it'll be available here: mods.pw/Bm (is it a coincidence, that the shortcode is my name's initial letters)
  16. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireArray.php#L716-L726
  17. Always open can be accomplished by using these styles e.g. with AdminCustomFiles: #main-nav > li > ul{ display: block !important; } #main-nav > li { background-color: #e2e9ef !important; }
  18. <?php // Everything is in /subdir (not as practical, but explains the intent) $file = __DIR__ . '/subdir/' . $page->template->name . '.php'; if(file_exists($file)) include $file;
  19. By default it's not possible to use subdirs, but you can use the settings for each template to change the file the template is associated with. Either just update it for some of your templates or just associate any template with some kind of routing.php, where you can implement any custom logic to route requests to the correct files.
  20. I'd suggest Robin's step 3 no matter if you need to match form submissions to payments or not. People might try to fake the form requests (if the CSRF token doesn't already do so) and with that hidden field you can always check things in hindsight should really something go wrong.
  21. addHookMethod !== addHook, but wire() is namespaced as ProcessWire/wire() since 3.0.
  22. https://processwire.com/talk/topic/7864-conditional-module-autoload/ This might be of interest for you.
  23. If it's not the php timezone, it could also be the mysql timezone setting.
  24. ProcessWire does not return a response until the admin thumb is generated, therefore it could also be, that the image is successfully uploaded, but something prevented a successful addition to the page or the resizing.
  25. Is it a single entry file field? If so, what does $download->of() return? Just in case try this one: $file = $download->download_files->first();
×
×
  • Create New...