Jump to content

Ivan Gretsky

Members
  • Posts

    1,473
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by Ivan Gretsky

  1. As for me, I always make separate templates for the ajax scripts. Something like ajaх-handler. This way I always get the API working right. I believe it is the recommended way to deal with this. Sorry for not answering the original question directly)
  2. Yes. If you're doing simple foreach and not sorting items yourself.
  3. Check if the selector returns any results (echo $posts->count;). Looking here, it seems like you've set your field and selector right, but just maybe you have changed default state for the Toggle Inputfield after it has been created for your posts and it still holds the '' (empty string) value for the most of them if not all. You can look in the database to be sure.
  4. Good day, @hellomoto ! I seems kind of hard to map arbitrary amount of csv values to repeater item values. I am having hard time imagining how this could be done via GUI. Do you have an idea how this could be done universally UI-wise? ...But it is quite easy to do in a custom script. Looking at a piece of code you presented I am sure you can easily handle this ?.
  5. Good day! I got a strange issue with webp images on one server. The same image works fine on Firefox and does not show (though blinks for a momдnent when trying to open it) in Chrome. I did regenerate it without luck. Then installed Imagick sizer, regenerated - same thing. Same code works fine on local machine, generating images readable in both browsers (or serving them in correct way), so must be a server issue. But what could it be? Example image used on this page. Please help!
  6. Hello, @ukyo! I absolutely love your module. And trying to incorporate it in my site-building workflow. I did install it without a problem and am using it for storing some output settings with great success) But today I found two (probably, related) bugs: I cannot create a new Page Reference field. I am getting this error: "Call to a member function getField() on null" (...\Mystique\FieldtypeMystique.module.php:71). I cannot view a list of pages with certain template (see the screenshot). The error message is the same. Do you understand what it is?
  7. Just to make it clear. You are talking about this module? I never used it myself though)
  8. Super cool stuff, @Robin S! Your modules are always the thing you wanted to, but never managed to do) I understand it is for all Repeaters not for Repeater Matrix only. But when used with Repeater Matrix it would be useful to: limit the RM types for the 0 level; limit the available children for a type. Maybe it is too much. And would probably require hooks to implement anyway, so not so useful for easy management. But just wanted to get those ideas out of my head)
  9. Thanks! But that is obviously not the case for me) Do you think we should try to change the situation by asking Ryan to add similar hookable methods to PageFrontEdit? Or does it seem impossible to implement anyway?
  10. Good day, @Robin S! I've just read through the whole forum thread and found out a lot of great things about this module. It is great and way more powerful than I could imagine! But the issue I was hoping to resolve wasn't there. I am trying to use the module in a frontend-edit context, but it doesn't seem to work. The Insert Hanna Code button isn't even in the toolbox. What am I doing wrong? Can I make it work here?
  11. 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).
  12. 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!
  13. 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.
  14. 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.
  15. 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)
  16. The read is as cool as the site @joshua! Could you share some more details (and maybe even code) about this: and this:
  17. 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.
  18. 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)
  19. Wouldn't it also break complex fields frontend editing, which happens in popup iframes with admin pages loaded?
  20. 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)
  21. 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.
  22. Lots of useless stuff on Wordpress, coronavirus, and motivating yourself to effectively deal with those, but not enough on ProcessWire))
  23. 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!
×
×
  • Create New...