Leaderboard
Popular Content
Showing content with the highest reputation on 02/26/2020 in all areas
-
@ryan many thanks for that useful piece of code. I used it a lot lately, also on sites that changed during my locally work. Therefor I need to adapt it a bit to first check if the remote file is available (and the optional use of basic auth). So, if it is of use for someone too, here it is: // use assets from remote host on demand for local development copies $wire->addHookAfter('Pagefile::url', function($event) { fetchRemoteAssetsToLocalDev($event); }); $wire->addHookAfter('Pagefile::filename', function($event) { fetchRemoteAssetsToLocalDev($event); }); function fetchRemoteAssetsToLocalDev($event) { if(!$event->wire('user')->isSuperuser()) return; // only my personal preference $config = $event->wire('config'); if(!$config->Remote2Local) return; // I set the domain name of a remote host in the site/config.php $remoteHost = 'https://' . $config->Remote2Local; // I always use https these days $file = $event->return; if('url' == $event->method) { $file = $config->paths->root . substr($file, strlen($config->urls->root)); // convert url to disk path } if(!file_exists($file)) { // download file from source if it doesn't exist here, but exist on source $src = $remoteHost . '/site/assets/files/'; $url = str_replace($config->paths->files, $src, $file); $http = new WireHttp(); if($config->Remote2LocalBasicAuth) { // optionally use basic auth with credentials from config.php $http->setHeader('Authorization', 'Basic '.base64_encode($config->Remote2LocalBasicAuth)); } // check if file exist on remote host $http->head($url, [], ['use'=>'curl']); if('404' != substr($http->getHttpCode($url), 0, 3)) { // file is available if($config->Remote2LocalBasicAuth) { $http->setHeader('Authorization', 'Basic '.base64_encode($config->Remote2LocalBasicAuth)); } $res = $http->download($url, $file, ['use'=>'curl']); } else { // file is missing, log it $event->wire('log')->save('remoteFetch404', $url); } } } // use assets from remote host on demand for local development copies4 points
-
Hi, here is some code written in the browser that may do it. You should doublecheck if your $file variable is the right file basename! $p = $pages->get($album); // get the page $p->of(false); $p->images->trackChange('description'); // prepare page to keep track for changes $selectedImage = $p->images->getFile($fileBasename); // Get the Pagefile having the given !basename!, or null if not found. $selectedImage->description = "Test description"; // set new description $p->save('images'); // save the page $p->of(true);2 points
-
You go away for a minute and this is what happens...? TL;DR From Device-centric to App-centric development: ambient computing Dart and Flutter ranked #1 and #2 for fastest-growing language and open source project respectively over the last twelve months - GitHub’s 2019 State of the Octoverse report. Flutter is now one of the ten most starred software repos on GitHub. Flutter described as “the fastest-growing skill among software engineers”. LinkedIn, 2019. Flutter for web is in beta. Flutter for desktop is in alpha for mac-OS. You can edit Flutter code, run it and view the rendered UI online in DartPad. See the samples drop-down on the top-right. Adobe XD, Supernova, etc: flutter plugins. Full announcement here. Videos here (Flutter Interact 2019).2 points
-
In accordance with the gist identified by Kongondo, I’ll comment that I figure most of the complexity will probably lie in your envisioned front-end. I’m certain that PW will work just fine as far as it is concerned, but it won’t help you any displaying a zoomable map and all that. This is an ambitious project if you’re really going to involve native mobile apps and payment processing. I would probably suggest keeping it simple for now, and just worry about getting your data from the user to your database and back. Working with data and users is pretty much a breeze with PW. While there may be more suitable products for your particular use case (you’d have to ask someone more broadly versed), I wouldn’t worry about the ProcessWire side of things too much. It’ll probably the part you’ll need the least help with. My tip would be to look into front-end people if you really are looking to hire. I should mention that my personal MO online is Hemingway-inspired, i.e. post drunk, browse sober, and right now I’m, like, really posting.1 point
-
Just update site/config.php If you want to keep the same config.php locally and remote, add a simple if statement or switch/case if ($_SERVER['SERVER_NAME'] === 'dev.mysite.com') { $config->dbHost = 'foo.mysql.db.host.com'; $config->dbName = 'xxxxx'; $config->dbUser = 'xxxxx'; $config->dbPass = 'xxxxx'; $config->dbPort = '3306'; }1 point
-
Hi @montero4, Moderation note: I have moved your topic to the General Support forum as the gist of your thread is about seeking advice. Hopefully here, you will get lots of advice. However, if at any point in the future you decide you want to hire a developer, please start a topic in that regard in the jobs board and cross reference this thread, if you wish.1 point
-
Thanks Horst. My file basename is correct as I am able to echo out all the properties of the image, but I did not know about trackChange perhaps that is the missing bit. $pgfile = $al->images->getFile($file); if($pgfile) { echo "basename => $pgfile->basename \n"; echo "description => $pgfile->description \n"; echo "ext => $pgfile->ext \n"; echo "filename => $pgfile->filename \n"; echo "filesize => $pgfile->filesize \n"; echo "filesizeStr => $pgfile->filesizeStr \n"; } The above echoes out all the properties as expected , but assigning description to something does not update it when I save page. I guess I'm only changing a local copy here and it's not "connected" to the page. I imagine the trackChange makes that happen. I will try it and report back. Many thanks1 point
-
1 point
-
1 point
-
Yep, I know. Therefore I'd like to use your hook you posted above to prevent an uninstallation mess. Currently, if someone uninstalls my module and the FieldType submodule is still in use the uninstall process is interrupted and parts of my module stay installed. Your code snippet seems to handle exactly this. I just wanted to know in which module to place this hook. Sorry, I just had a chat with @bernhard and confused your post with bernhard's.1 point
-
New showcase entry, for Rum Doodle Digital Marketing Agency https://rumdoodle.at/ Features On-Page SEO in full. Auto json and rich snippets Ajax contact form Bootstrap 4 Fontawesome (will be removed) Modules used Auto Smush Email Obfuscation (EMO) Markup Cookie Consent ConfigForm Fieldtype I love the part when I am not using too many fields and modules.1 point
-
Almost every time I find one of these interesting ML/AI/Science based Python projects I want to include in my own work, I run in major compatibility issues. Either a bound C library has changed its signature too much, or the Python lib never got adapted to version 3 (or 3.7 and another lib needs native types). To me it seems like Python is partly a graveyard of university projects nobody cared to continue. Not that Python is bad in general. When Google app engine support for Python came out I implemented a service together with two other devs (extending in-game functionality of a virtual world) that took up to a few million hits per day and was lots of fun to build. But developing in Python can easily become a package version nightmare, and most tutorials out there just ignore that, which adds a steep learning curve if you want to do complex projects in Python. pyenv and pipenv, which came out last year, only address parts of that. This xkcd is quite fitting I think ? I for one also have a (subjective) aversion to languages where whitespace has too much meaning. If you ever learned Cobol, you probably know what I mean...1 point
-
Python has one big advantage over PHP, which people might or might not care about: It‘s widely used for devops tooling because it‘s preinstalled on so many systems and it‘s growing super fast in the space of ML/AI/Science based computing because of it‘s bindings to fast low level C code while still writing python on top. If you care about those things or you want to do them as well, but not introduce a mix of technology, then sure python is a great solution. If not I don‘t see any reason to switch from whatever one is using right now.1 point
-
Personally I‘d first look into using an existing solution for gathering the data (I‘ve had good experience with https://feed2go.com/de/) and just create a way to bring back data into existing systems later. Webapps have the problem that their storage while available at times is not ensured to stick around. If e.g. the device disk space runs low it might be cleared out. Also you‘re already in the realms of a fully client side app, so you could just embrace it.1 point
-
Exactly what BitPoet said. Over the years I've heard over and over again how PHP is a dead/dying language, and how the future is all about [insert any imaginable language here]. If anything, I've learned not to care: PHP has been around for a long time, and to date it's still a lively project with a massive ecosystem. When I started with PHP 4 (or 3 — can't remember for sure) back in the days, it was a whole different language, really. 5.x made it a viable object-oriented language, 7.x brought in massive improvements in terms of features and performance, and 8 looks like it's going to be a blast as well. So yeah, I don't see any reason to jump the ship at this point; if anything, I'm pretty sure that PHP will have a lot more to offer in the future ?1 point
-
This is not a question about PHP, but a matter of your frontend. You should look into the Cache API, indexedDB and service workers. What you probably want, it to build a progressive web app. https://github.com/pazguille/offline-first https://ponyfoo.com/articles/backgroundsync https://www.twilio.com/blog/2017/02/send-messages-when-youre-back-online-with-service-workers-and-background-sync.html https://github.com/pulseshift/lunch-pwa https://github.hubspot.com/offline/docs/welcome/1 point
-
I've kept hearing that one for the last twenty years, yet here we are. I think that's enough said ?1 point
-
Hi guys, I was very excited for this module, but my life took a huge direction change and I no longer have the time to invest in module development. I am gonna leave the files here. You guys can take it and run. Maybe there might be something useful here. Maybe not. I still think it's a good idea to do drag and drop modal building in PW. So hopefully one day something like that can come to light. I love this community and I love ProcessWire. Live long and prosper. - Joshua Designme 2.zip1 point
-
I am not saying that at all. Nico is working at an agency these days that is mostly using MeteorJS, so I don't think he has much time to maintain his modules. I just thought it might be worth contacting him and seeing if perhaps you could take over his module, or let us know what advantages yours has over his. We're just all keen on limiting the number of module duplicates that WP suffers with - certainly not trying to diminish your efforts at all - sorry if it came across that way. I wasn't even sure if you knew about his module so it was also a bit of a heads up in that regard. Keep up the great work!1 point
-
And here's some code for those that may need it: $myfieldset_start = false; foreach ($page->template->fields as $field) { // or something like $this->templates->get('templatename')->fields if ($field->name == 'myfield') { // opening element of a fieldset is just the field name you gave it $myfieldset_start = true; } elseif ($field->name == 'myfield_END') { // ending element is field name with _END on it - break out of the loop if we reach this break; } elseif ($myfieldset_start == 'true') { // otherwise we are iterating fields in the chosen fieldset so do what you like here echo $field . "<br>"; } }1 point