Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by MarkE

  1. version 0.0.19 adds 2 new Measurement methods: baseMultiplyBy() & baseDivideBy(). You can use these instead of multiplyBy() or divideBy(), where it is expected that the result of multiplyBy() or divideBy() would be an unknown quantity. These methods anticipate that the result will be a BaseMeasurement and avoids unnecessary warnings
  2. Yeah great songs. But to bring order to the chaos, it must be JS Bach.
  3. Pretty much! The only difference is that I was using a page ref field for the template, rather than a parent.
  4. I was just starting to develop something similar, based on CSS grid, which I think is the right way to go. One thing my design has is “pro-forma” pages - ie pages with pre-defined layout and dummy content that you can use to create similar pages. This is an approach I have taken before for “standard letters” and works well. Not sure if that’s in your module @jploch, but I’m hoping I could easily add it. Anyway, I’ll hold off now and test yours, if I may. I have a project I was going to use which is a WP conversion with a simple theme, which I hope makes a reasonable test bed. I’ll also look into how well my (json-based) DbMigrate module plays with it.
  5. If you are a designer not a developer, then I would suggest trying to move a site from one CMS to another is a bit of an ask. If you are happy with the structure and just want to modify content, then you should be able to do that in ProcessWire without any particular technical or coding skills. If you want a new look and feel and don’t want to use a developer, then maybe start from scratch in WP, just copy and paste what content you need. That assumes that you are proficient in WP. I gave up on WP because, while it looks simple, the complexity goes up exponentially the more you try to do.
  6. I quite agree. BUT I think ProcessWire would benefit from a larger user group. Many (professional) developers are influenced by the critical mass of an open source solution - below a certain level and they are wary of being tied into a framework that may be going nowhere. For that reason, ProcessWire is often not chosen and an inferior, but more widely used, system is selected instead. The advantages that a page builder potentially brings are, to my mind: More users are attracted to PW. Some of these might be 'non-coders'. Equally, they may be people who can code (to some extent) but who just want to implement a simple site quickly (which might be enhanced later). A developer can off-load some of the work to a 'non-coder' who can focus on design aspects (this may be the client) However, the crucial point that @pwiredmakes is that the use of a page builder should not restrict the site further. The structure of ProcessWire is such that this ought to be achievable, but only if a page builder makes use of PW components in a transparent and modifiable way. There seems to be quite a bit of activity in this area, notably @Jonathan Lahijani's above and @bernhard's RockMatrix (still under wraps, I think), and it would be good to have a bit more visibility of the approaches used and how they meet these objectives. I have done a bit of thinking myself about how a page builder should look, but it's early days yet (and I don't want to re-invent the wheel). Ideally it would make use of standard PW components, but it would be opinionated to some extent (CSS grid and Tailwind seem obvious choices). Trouble is, most of the paths I have explored so far end up using RepeaterMatrix. Don't get me wrong, RM is a great field, but I don't think it's a great idea to have a page builder, which is designed to atrract new users, being dependent on a commercial module. P.S. Also, I think a page builder should allow for multiple themes, so that developers can easily add a new theme.
  7. That's a shame. Maybe an initial release would help 😉 At least some feedback might be useful.
  8. https://processwire.com/modules/app-api/ ?
  9. Technically, not a lot, since the generic QuickStart works well. The main reason would be for visibility. Someone installing ddev might be prompted to think about ProcessWire as a solution.
  10. I wonder if we could contribute a cms QuickStart for ddev. It would be nice to have ProcessWire listed there!
  11. Spot on @bernhard. Million thanks! But I'm still puzzled, because in the phpStorm data source definition, I have localhost and it works - if I change it to db, it doesn't work.
  12. Update to the above post. I changed all the name/user details to the defaults: $config->dbName = 'db'; $config->dbUser = 'db'; $config->dbPass = 'db'; $config->dbPort = '3306'; I realised that ddev assigns a dynamic db port so I added a static host_db_port: "3306" to .ddev/config.yaml. I can access the db in phpMyAdmin - and in the phpStorm database tool (now that it has a static port). I added a var_dump of pdoConfig to check what PW is looking for, namely array(5) { ["dsn"]=> string(40) "mysql:dbname=db;host=localhost;port=3306" ["user"]=> string(2) "db" ["pass"]=> string(2) "db" ["options"]=> array(2) { [3]=> int(2) [1002]=> string(16) "SET NAMES 'utf8'" } ["reader"]=> array(4) { ["dsn"]=> string(0) "" ["user"]=> string(0) "" ["pass"]=> string(0) "" ["options"]=> string(0) "" } } This matches exactly the config data I enetered into phpStorm's database tool (host: localhost, port:3306, user:db, password:db, database:db) which connects sucessfully. But I still get this error where the last array is ["options"] in the var_dump above. Any ideas? 😓
  13. Having problems with laragon so decided to switch to ddev. Installed docker & ddev just fine. Then wanted to set it up with an existing project, rather than start from scratch. So what I did was: change to the project directory ddev config ddev start imported the database (ddev import-db ...) using a copy downloaded from the live site That all seemed to execute properly. Then I ran the url given by ddev and clearly the php was executed but the db could not be found: The dbname etc. were the details for the live site (although I was expecting it to look for the dev site details as the $config->paths->root had not changed) EDIT: under ddev it has changed, so I changed my test condition in config.php for the dev environment accordingly Unfortunately, since laragon is not working any more (not php8.0 compatible and unable to upgrade) I couldn't get into phpmyadmin and export the database there). Any ideas on how to hook everything back together, @bernhard, @heldercervantesor others? EDIT: I see ddev changes all the database details to 'db'. I changed all the name, users etc to match, but still no luck.
  14. That explains a lot! I have LOTS of repeaters in this new app as it seemed a really neat idea from the point of view of the admin gui. Then I ran into LOTS of problems with dependent page selectors, which I think I’ve now fixed, either by contributions to the core or by the new CustomDependSelects module. I have wondered whether it would have been wiser to use plain pages. RepeaterMatrix does seem to be very popular (and I can see why), particularly for a UI for web page blocks. Other contributions on the “repeaters or no” discussion would be helpful.
  15. Well, more of a suggestion than a recommendation in https://processwire.com/blog/posts/pw-3.0.152/#custom-page-classes-vs-hooks However, it struck me as a good idea since any custom methods for all pages can go in DefaultPage and will be available to any other custom page classes. If, for some reason, you don't want to include the method in a custom page class, you can either declare it in the subclass or (to exclude them all) extend Page. Much better than adding methods to Page via hooks, no? So my practice is always to include a DefaultPage class, even if I end up putting nothing in it. Absolutely, but it is a rather large app, so difficult to encapsulate. The context is the same as the worked example here (which I will repeat for ease of reading): There is CiderPage.php containing: class CiderPage extends DefaultPage. This contains a lot of methods, but one simple one is: /** * Get the stage sequence as it is actually stored in the page array - this may be different from the 'sort' property * * @param $stage * @return false|int|string */ public function getStageSequence($stage): bool|int|string { $sort = array_search($stage->id, $this->stage->explode('id')); return $sort; } Ideally, I would have something like RepeaterStagePage class with method: /** * Get the stage sequence as it is actually stored in the page array - this may be different from the 'sort' property * * @return false|int|string */ public function getStageSequence(): bool|int|string { $sort = array_search($this->id, $this->getForPage()->stage->explode('id')); return $sort; } Admittedly, this is not any less code, but at least it would sit in the right place. For example, the first method would be less good if the stage field was used in a two different templates (which it is in fact, but the class of one -JuicePage - extends CiderPage, so it is not a problem in my case).
  16. That’s great @bernhard. I really think custom page hooks should be in the page class, not ready.php, which can get really messy. I have a couple of questions: why do you extend page rather than introduce an intermediate DefaultPage class as recommended by @ryan? how do you deal with pages that are repeaters (or repeaterMatrix)? Per a comment in the RepeaterMatrix forum, custom pages classes don’t work with these as they have their own classes which descend directly from Page and extending those classes is not advised. @ryansuggests using addHookMethod on RepeaterMatrixPage (or, presumably on RepeaterPage for plain repeaters), but that would place all the code in ready.php. The approach I have adopted is to put the methods in the page class of the getForPage with an argument for the repeater page object. Any suggestions?
  17. This looks really useful. For some reason I missed it at the time, but I thought I saw a tutorial covering it within the context of custom page classes generally - which I now can't find. Is there one @bernhard?
  18. I have used both and now just use this one on new projects. They both work fine in normal circumstances (and are easy enough to just temporarily install and play with), but @Robin S's is simpler with less to go wrong - I had a few problems with @kongondo's in a multi-instance environment (which I think are fixed). On the other hand @kongondo's has a slightly more feature-rich GUI. You could always build your own simple module rather than just use hooks if you want more than the basic RuntimeOnly and want control over the code - I forked this module to include a custom Fieldtype in my ProcessDbMigrate module. As @bernhard says, it all depends what you are trying to do.
  19. v0.0.3 fixes a bug experienced when saving page fields
  20. v0.0.17 released - allows use of RockCalculator in magnitude fields. You need to install RockCalculator separately to enable this. It is entirely optional, but helpful:
  21. Hi @bernhard. Had a quick look at this. It's a bit of a puzzle to me. The problem occurs when clicking the "Get Module Info" button on the new modules tab. I tried on 3.0.200 and 3.0.203 In 3.0.203, all I get is a compile error - see the title of this thread - so it's a bit difficult to diagnose as there is no obvious cause. This happens with RockCalculator and RockMigrations, but NOT RockFrontend. (Although I have not yet proceeded to install RockFrontend I have no reason to believe it won't install). In 3.0.200 I get the "ProcessWire: ProcessModule: No page specified" error. This is generated by ProcessPageEditImageSelect::init() (line 292 or 294). I have no idea why PW is even in that class. See the trace below Again, this happens with RockCalculator and RockMigrations, but not RockFrontend. I inserted a debug_backtrace - see here (unfortunately lost indents on paste from Tracy), which explains more: 3 => array 'file' => '.../admin/wire/core/Modules.php' 'line' => 1711 'function' => 'get' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'ProcessPageEditImageSelect' 4 => array 'file' => '.../admin/wire/core/WireArray.php' 'line' => 1763 'function' => 'find' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 5 => array 'file' => '.../admin/wire/core/WireArray.php' 'line' => 582 'function' => 'findOne' 'class' => 'ProcessWire\WireArray' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 6 => array 'file' => '.../admin/wire/core/Modules.php' 'line' => 1911 'function' => 'get' 'class' => 'ProcessWire\WireArray' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 7 => array 'file' => '.../admin/wire/modules/Process/ProcessModule/ProcessModule.module' 'line' => 1154 'function' => 'isInstalled' 'class' => 'ProcessWire\Modules' 'object' => ProcessWire\Modules count: 131 items: array 'type' => '->' 'args' => array 0 => 'installs=' 8 => array 'file' => '.../admin/wire/core/Wire.php' 'line' => 420 'function' => '___buildDownloadConfirmForm' 'class' => 'ProcessWire\ProcessModule' 'object' => ProcessWire\ProcessModule #359 'type' => '->' 'args' => array 0 => array 'status' => 'success' 'id' => 2236 'class_name' => 'RockMigrations' 'name' => 'rock-migrations-1' 'title' => 'RockMigrations' 'summary' => 'The Ultimate Automation and Deployment-Tool for ProcessWire' 'version' => 121 'module_version' => '1.2.1' 'created' => 1661782531 'modified' => 1662318506 'refreshed' => 1662616138 'url' => 'https://processwire.com/modules/rock-migrations-1/' 'details_url' => 'https://modules.processwire.com/export-json/rock-migrations-1' 'requires' => array 0 => '' 1 => 'installs=' 'requires_versions' => array '' => array 'installs=' => array 'installs' => array 0 => '' 'author' => 'bernhard' 'icon' => '' 'likes' => 1 'release_state' => array 'id' => 1083 'name' => 'stable' 'title' => 'Stable' 'url' => 'https://modules.processwire.com/release-states/stable/' 'pw_versions' => array 0 => array 'categories' => array 0 => array 1 => array 'authors' => array 0 => array 'authors_other' => '' 'project_url' => 'https://github.com/baumrock/RockMigrations' 'download_url' => 'https://github.com/baumrock/RockMigrations/archive/main.zip' 'forum_url' => 'https://processwire.com/talk/topic/27504-rockmigrations-' 'author_id' => 2865 1 => false
  22. Hi @bernhard. Just tried a different module (AppAPI) which is OK. The problem appears to be with your modules. I tried RockMigrations too - on v3.0.200 - both RockMigrations and RockCalculator give this error: ProcessWire: ProcessModule: No page specified
  23. Thanks @bernhard. That's helpful but doesn't work as $f->hasField is null because magnitude is a property of a measurement object field, not a field itself. So I tried the following code - creating a dummy field to hold the rockcalculator property: $f = $this->modules->get("InputfieldText"); if(wire()->modules->isInstalled('RockCalculator')) { $f->attr("data-rockcalculator", 6); //6 digit precision $f->notes = __("Numeric or math formula"); $dummyField = wire()->fields->makeItem(['name' => 'dummyName']); $f->hasField = $dummyField; $f->hasField->rockcalculator = true; bd($f, '$f in rockcalc'); } else { $f->notes = __("Numeric"); $f->precision = 6; $f->attr('type', "number"); $f->attr('step', "any"); } That almost works, in the sense that isEnabled() is true and loadAssets() runs. However the dev tools do not show the js as loaded and the field doesn't work. I've got round the problem by including the following in the init() of my fieldtype module: if(wire()->modules->isInstalled('RockCalculator')) { $rc = $this->wire->modules->get('RockCalculator'); $this->wire->config->scripts->add($rc->m('lib/math.min.js')); $this->wire->config->scripts->add($rc->m('lib/tooltip.js')); $this->wire->config->scripts->add($rc->m($rc->className . '.js')); $this->wire->config->styles->add($rc->m($rc->className . '.css')); } Maybe there is a better way, but at least this seems to work. And your module certainly enhances mine ☺️
  • Create New...