Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    314

Everything posted by bernhard

  1. Please don't ? We have a new way of doing that, because ->getUnformatted() also gets temporary items, which is likely not what you want. This is how to do it in recent versions: $page->get("images.first") --> I've searched hard but did not find the blog post about it ? Anyone?
  2. This is something I'd wish to have for UIkit as well. How did you do that in bootstrap?
  3. Nice, thx! Never needed it indeed ? Added to my alias ?
  4. Another reason for using an alias to create your ddev projects: I just realised that the timezone in my project was not correct so $page->modified times where 2hours off. Simple to fix: ddev config --timezone=Europe/Vienna To not forget it for the next project here's my current alias: alias ddc='ddev config --php-version "8.1" --database "mariadb:10.6" --webserver-type "apache-fpm" --timezone=Europe/Vienna'
  5. Just hit the same issue and fixing it was very easy thx once more to DDEV: ddev config --timezone=Europe/Vienna ?
  6. It's already fixed on the dev branch, I asked for help in the nette forum, thx ?
  7. I've just pushed v 3.1.0 which fixes some issues with the new asset loading implementation. I've also renamed the default asset name to "main" from "head" as @snck pointed out that "head" could be misleading as someone could think autoload styles named "head" will end up in the html <head> and styles named "body" will end up in the <body> tag. This is not the case. Autoload assets always land in the <head> as you can easily add the defer attribute! If you don't want that, you can do this wherever you want in your markup: <p>some markup</p> <?php echo $rockfrontend->scripts('yourbodyscripts')->add(...)->render() ?> </body> </html>
  8. Ok a client wanted me to do some gdpr imrovements so I added this to my Site.module.php ? public function init() { ... $this->wire->addHookAfter('LazyCron::everyDay', $this, 'gdpr'); } public function gdpr() { // delete old rockforms logs $logs = $this->wire->pages->find([ 'template' => RockFormsLogPage::tpl, ['created', '<', time() - RockMigrations::oneMonth], 'include' => 'all', // also trashed pages! ]); foreach ($logs as $log) $log->delete(); // delete old processwire logs $this->wire->log->pruneAll(30); } So RockMigrations just got an update to support time constants: // time constants (seconds) // see https://i.imgur.com/vfTasHa.png const oneMinute = 60; const oneHour = self::oneMinute * 60; const oneDay = self::oneHour * 24; const oneWeek = self::oneDay * 7; const oneMonth = self::oneDay * 30; const oneYear = self::oneDay * 365; And I also found there is $wire->log->pruneAll($days) which is also handy ? Again PW has all the tools to make very custom needs possible with just a few simple lines of code!
  9. The PW backend is extremely customisable all over both from the design and from functionality. For the design you can simply modify /site/templates/admin.less (https://processwire.com/blog/posts/pw-3.0.179/) or use AdminStyleRock (https://processwire.com/talk/topic/25668-adminstylerock-easily-style-your-processwire-backend-with-two-simple-settings/). So you can very easily adopt spacings, fonts, font-sizes etc. For functionality you can use hooks or custom admin pages aka process modules (https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/).
  10. Hey @zoeck I've updated an older site to the latest version of RockFrontend (+116 commits ? ) and got this error, which is caused by the LattePanel: The API docs say that ::initialize is deprecated: https://api.nette.org/latte/master/Latte/Bridges/Tracy/LattePanel.html But no idea why this is a problem on this installation since all other projects are also running on php8.1 and don't complain? Any ideas?
  11. One possible solution: $wire->addHookBefore("Inputfield(name=title)::render", function ($event) { $f = $event->object; $id = $this->wire->input->get('id', 'int'); $f->appendMarkup = "<script>alert('You are editing page #$id')</script>"; });
  12. RockFinder is just for pulling data from the database. We actually now have $pages->findRaw() which makes RockFinder obsolete in many cases. The ->dump() method is just for debugging, but if you look into the code you can see how it's done. It uses tabulator.info to display the data that RockFinder pulls from the DB. So you can quite easily build a Lister / ListerPro alternative with findRaw/RockFinder and tabulator. If you don't want to build it on your own you can write me a PM and buy a license of RockGrid, which was built exactly for that purpose, namely taking a RockFinder/findRaw result and turning it into a tabular grid with sorting and filtering capabilities: But even when using my module you need to code your grid via JavaScript, so it's not a click-click solution. But it helps you to get setup quickly and to make the foundation well structured and future proof (maintainable) and it even creates the necessary boilerplate files for you (basically a PHP file for grabbing data via RockFinder and a JS file for setting grid options like sorting, column labels, column widths etc). So you just need to click on "create new grid" and then edit these two files: JS $(document).on('RockGrid2', function() { let rg2 = RockGrid2; // this will add the grid using the default base setup // if you want to use another base setup set it as 3rd argument // see RockGrid2.js for more details rg2.add('Demo', { // here you can set any properties of your grid paginationSize: 15, // column definitions autoColumnsDefinitions:function(definitions) { // loop all definitions and set column settings definitions.forEach((col) => { let name = col.field; // example how to use the link() helper if(name == 'id') { col.width = 50; col.hozAlign = 'center'; col.formatter = function(cell) { let id = cell.getValue(); return rg2.link({ icon: 'edit', href: rg2.editUrl(id), tooltip: 'Edit this page', panel: true, }); } } // example how to use a predefined coldef // you can use this technique with your own coldefs as well if(name == 'title') { rg2.setColDef(col, 'edit'); } }); return definitions; }, }); }); PHP <?php namespace RockGrid2; class Demo extends Grid { public function info() { return parent::info()->setArray([ 'title' => 'Demo Grid', 'icon' => 'check', ]); } public function getData() { // we use findRaw in this example because it is shipped with the core // my recommendation is to use RockFinder3 as it provides a lot more // and customized options for working with PW page data in grids $data = $this->findRaw("id>0, limit=50, sort=-id", [ 'id', 'title', ]); bd($data); return $data; } public function isViewable() { // who has access to this grid? return true; } }
  13. It depends a lot on the project and on your skills. If the PW backend fits your needs, then you'll have a lot less work and headache if you build on top of that. If you have very custom requirements in terms of UI/UX then it might be easier to build a custom backend from scratch. But as you have already mentioned you then also have to take care of everything that PW already does (security, interactivity, permissions etc...) The forum is not built with PW, it just uses the same editor as PW did until recent updates. The link to the forum software is in the footer.
  14. Isn't it just $this->wire->config->js('mySettings', ...) ?
  15. Is anybody experiencing assets loaded multiple times with the new version? If so please let me know (and even better try to find the issue if you can) ? I've had the issue for a short time during development but then it disappeared so I thought it's fixed, but @snck reported the same problem with the latest release. I can't replicate it on my end so it's a little hard to fix ? Edit: We found the issue and I'm working on it ?
  16. Why and where do you want to dump your data? Just for debugging?
  17. @adrian do you have any reproducible example?
  18. Hi @eydun you don't need RockFinder for that, you can just use the core: $database = $wire->database; $query = $database->prepare("SELECT id, class, created FROM modules"); $query->execute(); while($row = $query->fetch(\PDO::FETCH_ASSOC)) { db($row); } $query->closeCursor(); You could also use the DatabaseQuerySelect abstraction: $q = new DatabaseQuerySelect(); $result = $q->select('id, class, created') ->from('modules') ->execute(); while($row = $result->fetch(\PDO::FETCH_ASSOC)) { db($row); }
  19. Ok learning from the last 2 days: The action that I'm using uses the "angular" preset which has a slightly different syntax than what is listed on https://www.conventionalcommits.org/en/v1.0.0/ Using the conventionalcommits would be possible (https://github.com/TriPSs/conventional-changelog-action/issues/217), but that would mean we had to "npm install" some dependencies, which is not what I want, as the nice thing with this setup is that everything works out of the box with just adding one file to your repo. Memo: Breaking changes need to be written with a "BREAKING CHANGE: ..." footer to trigger a major version bump. The exclamation mark syntax like "feat!: ..." does not work. Thx @dotnetic for your help!
  20. Be sure to check out the new version which has a "security" update:
  21. New month, new version: https://github.com/baumrock/RockMigrations/releases/tag/v3.26.0 Bug Fixes double linebreaks (bf07c6b) magicpages comparing classnames without namespaces (28b5657) prevent migrating pageclasses twice (b3c9add) remove double slash when using $this->path (aa9502c) wirerandom issue on deployment (29bd145) Features add placeBefore to wrapFields() (906753c) add random salts to config-local suggestion (1e7401c) add rm-hints to field and template gui (27b5b25) add support for parent_id as page path (e45e430) imporve createPage for array syntax (74bd338) improve getTemplate (use ::tpl fallback) (b6f6d14) improve isDDEV() (e4df541) improve setFieldData() method (2830eed) use $this->path instead of DIR #22 (f134e1b) One very nice feature is that RockMigrations now adds uikit tooltips to the field and template editor where you can directly inspect the name of the property to use and also the value of one setting, which is very handy if you need a setting that you don't know by heart. With this update you don't need to find the setting by inspecting the html markup any more and you can instantly see it by hovering over the setting:
  22. I've just released RockFrontend 3.0 https://github.com/baumrock/RockFrontend/releases/tag/v3.0.0 @netcarver found that .less and .latte files were publicly accessible if you knew the file path (eg example.com/site/templates/sections/footer.latte) which is for sure something that you don't want even though it should not really be a security concern. Sorry for that and thx for spotting @netcarver ! The latest release updates /site/templates/.htaccess to block access to .latte/.twig/.blade/.less files so be sure to upgrade RockFrontend in all your installations! Other than that I've also changed the way how RockFrontend loads assets and I'm not 100% sure if that might introduce issues in existing sites, so be sure to check if everything works as expected. New features: RockFrontend now ships with https://github.com/wasinger/htmlpagedom wich let's you parse and manipulate html markup which can be super handy in several situations. I'm using it on my new website where I'll show docs for all my modules that are rendered from markdown files and add some magic here and there via manipulating the resulting html that comes from the markdown parser. Improvements for the Topbar: There is now a toggle that makes it possible to hide/unhide the bar instantly (and persistantly). Also you can add your own custom markup to the topbar by adding custom markup to $rockfrontend->topbarPrependMarkup or topbarAppendMarkup.
  23. I'm using DDEV, so every project has it's own URL like myproject.ddev.site https://processwire.com/talk/topic/27433-using-ddev-for-local-processwire-development-tips-tricks/ That works great for PW but not sure if that also works for WordPress as I heard it does weird things with hardcoded hosts all over?!
  24. There's this: https://processwire.com/talk/topic/18719-maintain-separate-configs-for-livedev-like-a-boss/ And this: https://github.com/processwire/processwire/pull/267
×
×
  • Create New...