Jump to content

Ivan Gretsky

  • Content Count

  • Joined

  • Last visited

  • Days Won


Ivan Gretsky last won the day on February 22 2019

Ivan Gretsky had the most liked content!

Community Reputation

1,140 Excellent

1 Follower

About Ivan Gretsky

  • Rank
    Hero Member

Profile Information

  • Gender
  • Location

Recent Profile Visitors

7,391 profile views
  1. Hey @JeevanisM! You probably shouldn't override the core module, as all the good men stated above. But it's nice to know you can (and I actually did this before exactly with Comments field - hope it is easier to customize it now).
  2. Go here and star the repo) P.S. And, of course, keep the love to ProcessWire always burning deep in you heart. But do star the repo too, to make your inner feelings make a a change in the world!
  3. Good day @Soma! Great module! I've been using it forever and can't live without it. When I login to any site without it installed, I feel kind of helpless for a while) My problem is it does not show the link for the RepeaterMatrix fields. Not an error like in the post above, but nothing at all. Could you please check? Created a github issue for this too. Edit: Sorry for incomplete report. The link is there, when all the items are collapsed. But if the "Remember, which repeater items are open?" option is checked, and one of the items is expanded on page load, the link is gone.
  4. Good day! One way could be to include all videos in the mobile app installation package, so all the content is downloaded when the app is installed. I am not sure it is possible, or if there is a restriction on what you can put in the installation package and the size of the app, if distributed with the official stores. But that would be not a PWA thing, but rather a native app. The other would be to allow to download (cache) just the videos you need from the list in the app. So you install the app and then download the ones you need, while still "have the Internet". This should be available in PWAs as well as in native apps. But anyway, there must be problems with caching Youtube videos you're using. I would expect problems caching those.
  5. I am using rsync to copy files between local and prod envs. Making an automation script was sitting in my todo list for way too long. So eagerly waiting for the sequel)
  6. The read is as cool as the site @joshua! Could you share some more details (and maybe even code) about this: and this:
  7. As I get it, you just want to show a list of some pages in the page edit screen, without the need to interact with them. I think you need not use Page Reference field for that, but something like RuntimeMarkup.
  8. Great job! With the time you start appreciating such things as robust and maintainable core as much if not more than some shiny new features) And doing it little by little is surely better than a death by rewrite) Way to go, @ryan! And I'm sure you'll fix a lot of bugs by the way in addition to make a few new ones)
  9. Wouldn't it also break complex fields frontend editing, which happens in popup iframes with admin pages loaded?
  10. Hello! I need to show pages with date range publish limitation. I mean each page has date_start and date_end fields, that, if populated, should determine, whether the page is considered "published" today. But none of those fields is mandatory. You can fill one or the other or both. I have written a selector with OR-groups like this: $selector = "SOME-CONDITION-HERE, "; $selector .= "range=(date_start='', date_end=''), "; $selector .= "range=(date_start='', date_end>=today), "; $selector .= "range=(date_start<=today, date_end>=today), "; $selector .= "range=(date_start<=today, date_end='')"; But is seems a little ugly and over-complicated. I thought maybe someone could propose a better solution? If not, let it be a working example of how to deal with this)
  11. Maybe it is worth rethinking this implementation? When checking is a field is empty or not, for example, fallback to default is a bug. The hack solution is kinda ugly and unintuitive. And one of PW's strongest points is multi-language support. What do you think, @ryan? P.S. I just tried it out one more time. It seems that if you check if the field is empty using just the field name, it checks only the default language. So if the field has text in user lang but not in default, the check is falsely false. So might be a real bug here.
  12. Lots of useless stuff on Wordpress, coronavirus, and motivating yourself to effectively deal with those, but not enough on ProcessWire))
  13. Most of us know and use site/config-dev.php file. If present, it is used instead of site/config.php, so it is easy to set database connection and debug mode for local development, not touching the production config. It is also very useful when working with git. You can simply ignore it in the .gitignore file, so local settings won’t end up in the repo. But sometimes you need to add code to site/ready.php or site/init.php just for the dev environment. For example, to add ryan’s super cool on demand images mirrorer. I can’t live without it when working with big sites, which have more assets then I want to download to my desktop. It would be great if there was something like site/ready-dev.php for this. Not out-of-the-box, but it’s pretty easy to achieve. Unlike site/config-dev.php, site/ready.php is not hardcoded. It’s name is set with a special config setting: // wire/config.php $config->statusFiles = array( 'boot' => '', 'initBefore' => '', 'init' => 'init.php', 'readyBefore' => '', 'ready' => 'ready.php', 'readySite' => '', 'readyAdmin' => '', 'render' => '', 'download' => '', 'finished' => 'finished.php', 'failed' => '', ); As you can see, we can not only define, which files are loaded on init, ready and finished runtime states, but probably even add more if we need to. So we override this setting in site/config-dev.php like this: // site/config-dev.php // Change ready.php to ready-dev.php $temp = $config->statusFiles; $temp['ready'] = 'ready-dev.php'; $config->statusFiles = $temp; For some reason we can’t just do $config->statusFiles['ready'] = 'ready-dev.php'; and have to override the whole array. Maybe you PHP gurus can explain this in the comments. Now we can create the site/ready-dev.php file and place all the dev-only code there. Important thing is to include the main site/ready.php. // site/ready-dev.php include 'ready.php'; // DEV HOOK TO MIRROR ASSETS ON DEMAND $wire->addHookAfter('Pagefile::url, Pagefile::filename', function($event) { $config = $event->wire('config'); $file = $event->return; if($event->method == 'url') { // convert url to disk path $file = $config->paths->root . substr($file, strlen($config->urls->root)); } if(!file_exists($file)) { // download file from source if it doesn't exist here $src = 'https://mysite.com/site/assets/files/'; $url = str_replace($config->paths->files, $src, $file); $http = new WireHttp(); try { $http->download($url, $file); } catch (\Exception $e) { bd($file, "Missing file"); } } }); Do not forget to replace "mysite.com" if you’re copypasting this)) Now, add the newly created file to the `.gitignore` and we’re done. # .gitignore # Ignore dev files site/config-dev.php site/ready-dev.php Thanks for reading!
  14. Great read! Perfectly laid out! A ready Medium article in a post! And maybe it should be published elsewhere, as it provides a lot of useful info not only for PW devs (and would bring some attention to PW).
  • Create New...