Jump to content

bernhard

Members
  • Posts

    4,848
  • Joined

  • Last visited

  • Days Won

    204

bernhard last won the day on January 24

bernhard had the most liked content!

Contact Methods

  • Website URL
    https://www.baumrock.com

Profile Information

  • Gender
    Male
  • Location
    Vienna, Austria
  • Interests
    Sports

Recent Profile Visitors

19,799 profile views

bernhard's Achievements

Hero Member

Hero Member (6/6)

6.9k

Reputation

12

Community Answers

  1. // site/migrate.php $rm->installModule('YourModule', [ 'fooSetting' => 'fooValue', 'barSetting' => 'barValue', ]); See https://github.com/baumrock/RockMigrations/blob/main/profiles/default.php for inspiration. Please let me know if anything is unclear and can be improved.
  2. Hi @daniel_puehringer What about just populating the cache via cronjob and don't care too much about the timings? The cronjob would run every 24 hours so it should be enough to just overwrite the cache when the cron runs: // in the cronjob $data = ...; // get data via WireHttp $wire->cache->save('your-cache-name', $data); // purge procache // https://processwire.com/api/ref/pro-cache/clear-page/ $procache->clearPage($your_cached_page); And in the template you just output that value: echo $wire->cache->get('your-cache-name'); That should be everything you need. To make it more robust you could create a little module that has a method that fetches data: <?php namespace ProcessWire; class Site extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Site', 'version' => '0.0.1', 'summary' => 'Site Module', 'autoload' => true, 'singular' => true, 'icon' => 'bolt', ]; } public function init() { // make this module available as $site API variable $this->wire('site', $this); } public function fetchYourData() { $data = ...; // get data via WireHttp $this->wire->cache->save('your-cache-name', $data); return $data; } } Then the cronjob gets easier: $site->fetchYourData(); $procache->clearPage($your_cached_page); And the template file get's more bulletproof, because if the cache is not available for whatever reason it will go and get it from the remote site: echo $wire->cache->get('your-cache-name') ?: $site->fetchYourData();
  3. v2.19.0 comes with a new handy javascript snippet that can help, for example, to create to-top-links that slide in after a certain scroll position: If you have ideas for improvement let me know!
  4. Thx to feedback and a good find from @Stefanowitsch v2.18.0 also copies .css.map files over to the assets folder, which is helpful if you are using one of the postCSS features like rfGrow() or rfShrink() You are not using them yet? You are missing something! They are so great πŸ₯°
  5. Nice! https://drawsql.app/teams/baumrockcom/diagrams/processwire
  6. I knew that was spam. Interesting conversation nonetheless πŸ™‚
  7. If you are faster with another system then of course it's likely better to go with that πŸ™‚ I'm just trying to be fair to PW so I tried to challenge your statements as I think they are at least partly not correct or at least incomplete πŸ˜‰ "others bring better functionality" is just an opinion and you don't bring any arguments for that. Didn't see that part, sorry. Sure. And almost everytime I ended up thinking that I'd be much faster with PW. But obviously that's the tool I know the best. Sure, agree on that. I'm just not on line with the arguments you brought up against PW πŸ˜‰ Not saying PW is ideal for that (though it can be in some situations). Just tried to be fair πŸ˜‰ I mean... you are right that sometimes it's not the easiest thing to adjust the backend menu to your needs, but what I wanted to say is that you should not forget that it might not be easier/faster to build everything on your own that you get in PW by default... I think what is really missing for building a CRM with PW is a good data listing tool. I've built RockGrid for that but it's far from perfect πŸ™‚ The other big missing thing would be migrations, but there's RockMigrations and that is in my opinion a lot better than what you get with Laravel!
  8. Thanks guys, I've added a config setting for the z-index of the topbar and changed the default from 99 to 999 πŸ™‚
  9. I'm not saying anyone is right or wrong, but I want to add: You can always build everything (the backend/GUI) on your own just like you have to when using any other php framework if you think that would be faster πŸ˜‰ Nobody holds you from using PW in a traditional way. You can create DB tables and use SQL to query the data. Sure. Every pro comes with cons. PW's database system is built to support all the great flexibility and the ease of use via the API that we all love (I guess). If creating and restoring things from a single DB table is a priority for you, why don't you store all the data in a single table that can easily be restored? If the answer is that you would lose all the great features of PW (like page reference fields etc) and you know all the things that you'd need to build on your own in other frameworks. But I have the best knowledge about PW obviously so I might be wrong when it comes to judging other frameworks πŸ™‚
  10. Hi @Stefanowitsch it should show this: I'm not sure about the logo there and am open to feedback.
  11. $wire->addHookBefore("Inputfield(name=roles)::render", function (HookEvent $event) { $field = $event->object; $field->appendMarkup = " <div class='uk-margin'> <button class='ui-button' data-options='1'>Options 1</button> <button class='ui-button' data-options='2'>Options 2</button> </div> <script> $(document).on('click', '[data-options]', function(e) { e.preventDefault(); let options = $(e.target).data('options'); if(options == '1') { $('input[value=37]').prop('checked', true); $('input[value=38]').prop('checked', false); } else if(options == '2') { $('input[value=37]').prop('checked', false); $('input[value=38]').prop('checked', true); } }); </script> "; }); Just adjust name=roles to name=your_options_field and value=37/38 to value=your_option_id (inspect via devtools) Have fun πŸ™‚
  12. Hey @protro congrats and thx for sharing and for mentioning RockFrontend πŸ™‚ I'd love to add such features to RockFrontend, so if anybody has good suggestions please create a thread in the dedicated forum!
  13. Sure, done! Thx for the input πŸ™‚
  14. Does anybody know how we can insert buttons with custom classes in TinyMCE ?? That's a VERY common need, eg to add "uk-button-primary" to a link that was inserted via the TinyMCE field. As @jploch mentioned the inline styles seem not to work on anchor tags 😞
  15. Your error tells you that the requested file does not exist. If the file exists, then it means that your provided path is wrong. You seem to include/render "partials/foo.php", but if you are already rendering/including a file in the partials folder, than from within that file you cant render/include "partials/foo.php" because that would look for "partials/partials/foo.php". That's why you just provide "foo.php" and it should work. If you use render() than you can RETURN something in a file and that will be returned to the place where you made the $files->render() call. If you do an "echo $files->render(...)" then it will echo the output. If you do $foo = $files->render(...); you can do whatever you want with $foo after that call. If you use include() on the other hand the code in the included file will directly be executed and nothing will be returned, so you can't use include() to populate variables with the content of a file.
Γ—
Γ—
  • Create New...