-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Are you using flexbox for your new layout?
LostKobrakai replied to OrganizedFellow's topic in Dev Talk
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. -
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.
- 75 replies
-
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
- 75 replies
-
- 1
-
Related pages: How to enforce uniqueness and minimum/maximum count?
LostKobrakai replied to wet's topic in API & Templates
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. -
Has anyone tried p:empty{ display:none; }?
-
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/
-
I've had similar issues in the past, but not anymore for at least the last year or so.
-
Including dynamic content in search results
LostKobrakai replied to joe_ma's topic in General Support
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). -
Glad to hear that. If some of you guys are using it I'd really like to hear your thoughts or issues.
-
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.
-
For those interested, do not buy it in a rush. I've the previous issue at home now.
-
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)); });
- 7 replies
-
- 11
-
$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.
-
jimdo squarespace weebly wix & c. - the end of web programming as we know it?
LostKobrakai replied to dlen's topic in Pub
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. -
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)
-
https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/WireArray.php#L716-L726
-
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; }
-
Does PW support organizing Template files in sub Dirs ?
LostKobrakai replied to EyeDentify's topic in General Support
<?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; -
Does PW support organizing Template files in sub Dirs ?
LostKobrakai replied to EyeDentify's topic in General Support
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. -
A couple of questions about the ProcessWire Form Builder
LostKobrakai replied to Neo's topic in General Support
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. -
addHookMethod !== addHook, but wire() is namespaced as ProcessWire/wire() since 3.0.
-
What gets executed on each page load?
LostKobrakai replied to bmacnaughton's topic in General Support
https://processwire.com/talk/topic/7864-conditional-module-autoload/ This might be of interest for you. -
Session Handler Database: times out by two hours
LostKobrakai replied to Robin S's topic in General Support
If it's not the php timezone, it could also be the mysql timezone setting. -
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.
-
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();