Jump to content

bernhard

Members
  • Posts

    6,312
  • Joined

  • Last visited

  • Days Won

    318

Everything posted by bernhard

  1. What is your plan to make the page name unique? Do you want to add the page id or such?
  2. Mine was also ? This helped me and may also help others: https://youtu.be/EeCNlB7v08I?t=161
  3. I've never done that myself but you could also do a get request to that page automatically on save: <?php $wire->addHookAfter("Pages::saved(template=yourtemplate)", function($event) { $page = $event->arguments(0); (new WireHttp())->get($page->httpUrl); }); This might slow down saving the page for the client, but it would create all image variations for website visitors and you'd not need to define all the image variations in the hook or keep your template and the hook in sync... Happy to hear how that worked!
  4. $rm = $modules->get('RockMigrations'); $rm->createField('demo_page', 'page', [ ... ]) $rm->createField('demo_repeater', 'repeater', [ 'repeaterFields' => [ 'demo_page', ], ]); Something like that?
  5. No hurry as long as the next update will have this change in place so nothing breaks on my end ?
  6. @David Karich could you please modify the js script a little so that we can set the page id of the tracked page manually as function parameter? The example of the docs can then be simplified a lot from this: $(function(){ if($('a.news_tag').length > 0) { $('a.news_tag').each(function(){ var tPID = $(this).data("pid"); if(tPID) { $(this).on("click", function(){ $.post(location.pathname.replace(/\/?$/, '/') + 'phcv1', {pid: tPID}); }); } }); } }); To something like that (untested): $(document).on('click', 'a[data-pid]', function(e) { let pid = $(e.target).data('pid'); if(pid) PHC.track(pid); }); PS: The reason why I need this is I'm using barba.js for page transitions so I need to send page tracking manually after each transition and the <body> tag is not updated from one page to the other meaning that automatic tracking via body[data-phc] does not work...
  7. ok then $page->getUnformatted('file_field')->addFromUrl(...) would also work ?
  8. Wouldn't it be better to do the $page->of(...) inside the addFromUrl method?
  9. From a conversation with ryan I think to remember that /site/assets is supposed to be writable while /site/templates is not. https://processwire.com/docs/start/structure/files/ does not state the latter one but it confirms my first point.
  10. My opinion: Great work. I was impressed ? Only thing was after I clicked skip intro I got a strange sound and was not able to turn that off. No mute button or the like... a page refresh made the annoying sound go away.
  11. Jep, thx ? Yeah, I'm using that often, thx. Just needed to test a little new module that handles API requests and I was totally confused that things where all NULL in my console code whereas values where obviously saved in the config (as fields where filled). Thx for the fix!
  12. hey @adrian hope you are fine ? today I noticed a very strange issue with this little and simple module: When I do this: $m = $modules->get('Demo'); db($m); db($m->url); ...in the Tracy Console it does NOT show any data when I'm in the module's config screen. When I'm on any other page it shows data as it should. Note that the issue does only occur on a non-autoload module. Making the module autoload fixes the issue (that might help for debugging). Any ideas why this could happen? --- On module's config page: On any other page:
  13. @Jonathan Lahijani how/where do you define the markup for all those elements? For example the image... Does it use some kind of $img->maxSize(x, y)->url or does it show the originally uploaded image, which might be several MB in filesize?
  14. bernhard

    Wireframe

    I'm not sure what I was talking about back then, but you can simply do something like this: <?php namespace ProcessWire; class MyPage extends Page { public function init() { $this->addHookAfter("ProcessPageEdit::buildForm", $this, "buildForm"); } public function buildForm(HookEvent $event) { $page = $event->process->getPage(); if(!$page instanceof self) return; // $page is a MyPage object now $form = $event->return; // get the title field and add a note if we find it if($f = $form->get('title')) { // note that we use $page->foo() and not $this->foo() $f->notes = "I am a MyPage object and my foo() method says: ".$page->foo(); } } public function foo() { return 'MyPage-Foo!'; } } Note that the hook in this example never gets executed! You'd need to trigger it once. Where you do that is up to you - I'm usually doing that via RockMigrations (https://github.com/BernhardBaumrock/RockMigrations/blob/5cafb3c6c0f2004b8d4087ca243cc0d5f771dd11/RockMigrations.module.php#L377) but you could also add it in init.php <?php $tmp = new MyPage(); $tmp->init(); This adds a little overhead since we load an additional instance of MyPage on every request but I do much more prefer that over getting more and more of a hook hell on larger projects. The way I showed above is much cleaner and keeps everything where it belongs: To the MyPage class. Now once you open a MyPage in the PW backend you get the note on the title field and you know where to look for that hook: In MyPage.php - not in ready.php, or init.php, or another module, or wherever else...
  15. I don't know much about datetime libraries, just know that tabulator.info recently replaced momentjs by luxon. http://tabulator.info/docs/5.0/release#dependencies https://github.com/you-dont-need/You-Dont-Need-Momentjs https://www.htmlgoodies.com/javascript/luxon-vs-moment-javascript/ Good luck with your new challenge ??
  16. What happens if you use the show() method? https://github.com/BernhardBaumrock/RockPdf#different-output-types
  17. This feature was added lately ? Docs can be found here: https://processwire.com/blog/posts/pw-3.0.181-hello/
  18. This feature was added lately ? Docs can be found here: https://processwire.com/blog/posts/pw-3.0.181-hello/
  19. I guess you'll have some JS errors in the console then? What does it say? Well... that's not an easy question. For my admin projects I'm using RockGrid2 which is the successor of RockGrid, RockTabulator and RockDataTables ? It is based on v4 of tabulator.info and can use plain PHP arrays (such as findRaw) or RF3 etc as data source. But it is not finished and will not be publicly available any time soon. Likely never. All the other modules will most likely not get any updates in the future as I don't need them any more. If someone really needs some of this stuff I'm happy to help or discuss what we can do via PM. Hope that helps at least a little bit ?
  20. Thx for your help guys. I changed my PHP version on my local laragon and now everything works fine!
  21. Hey @David Karich I wanted to install PHC + RHC today like this: <?php // install page hit counter $phc = $rm->installModule("PageHitCounter", "https://github.com/FlipZoomMedia/PageHitCounter/archive/refs/heads/master.zip"); if($phc) { $rm->setModuleConfig($phc, [ 'forTemplates' => [ 'home', 'basic-page', // blog Item::tpl, Overview::tpl, // teams TeamPage::tpl, PersonPage::tpl, ], // exclude roles from tracking 'forRoles' => [ 'superuser', 'webmaster', ], ]); $rm->installModule("PagePaths"); $rm->installModule("RockHitCounter"); } } This does ALMOST work. The problem seems to be that the "addCounterField" method does not get triggered when using RockMigrations compared to a manual module save: <?php // ------------------------------------------------------------------------ // On save actions // ------------------------------------------------------------------------ if($input->post->submit_save_module) { $forTemplates = (array) $input->post->forTemplates; $forAPITemplates = (array) $input->post->forAPITemplates; $thousandSeparator = (string) $input->post->thousandSeparator; $cookielessTracking = (int) $input->post->cookielessTracking; $sessionLifetime = (int) $input->post->sessionLifetime; $ignoreURLSegments = (int) $input->post->ignoreURLSegments; $ipFilter = (string) $input->post->ipFilter; $botFilter = (int) $input->post->botFilter; $customAttributes = (string) $input->post->customAttributes; $forRoles = (array) $input->post->forRoles; $showForBackend = (int) $input->post->showForBackend; $ipValidation = (int) $input->post->ipValidation; $excludeTemplates = (array) $input->post->excludeTemplates; // ------------------------------------------------------------------------ // Perform counter reset // ------------------------------------------------------------------------ if($input->post->resetSelector !== "") { $modules->get("PageHitCounter")->resetPageViews((string) $input->post->resetSelector, (int) $input->post->dryRun); } // ------------------------------------------------------------------------ // Add phit field to selected templates // ------------------------------------------------------------------------ $modules->get("PageHitCounter")->addCounterField(array_unique(array_merge($forTemplates, $forAPITemplates))); } Any ideas how we could make your module work with RockMigrations without having to do a manual module config save? Thx ?
  22. Can anybody try if downloading https://www.baumrock.com/site/assets/files/1192/mockup_mustangs.800x0.png via WireHttp works on their end please? $http = new WireHttp(); $http->download('https://www.baumrock.com/site/assets/files/1192/mockup_mustangs.800x0.png', __DIR__ . '/tmp.jpg');
×
×
  • Create New...