Jump to content

Kiwi Chris

  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Kiwi Chris

  1. I've sometimes had this kind of issue when I intended to assign something to a variable to output later, and instead output it with an echo statement. Also HTML code in a template will immediately render instead of being assigned to a PHP variable if you don't use PHP output buffering. Check the source code of the output.
  2. Tracy was useful in testing out what I'm trying to achieve. I'm trying to get away from copying and pasting though. I used the Tracy console, and this code is on the track of what I want: $modulePath = $config->path('MyModule'); //moduleFields is an array of field names foreach($moduleFields as $fieldname){ $testField = $fields->get($fieldname); $data = wireEncodeJSON($testField->getExportData(),true,true); $file = $modulePath . 'data/fields/'. $fieldname . '.json'; file_put_contents($file, $data); } This gives me a nice directory of field definitions that are required by a given module. ProcessWire already handles module dependencies including module versions with the requires property in getModuleInfo(), so if I define fields that are used in multiple places in a base module and specify that as a dependency of other modules that install other fields, then I can make sure I end up with all the fields that I need. Because I'm using a manually created array of field names, if there are fields that depend on other fields, I can list them in the right order to satisfy dependencies. Fields like page reference fields can depend on a template as well, so my array might need to specify both object name and type to install all the dependencies in the correct order, but I think I'm on track to being able to build a reproducible configuration I can easily deploy to multiple sites. I think it might not be too hard to build and admin module to provide a UI to build the dependency configuration files for custom modules either, as ProcessWire already supports adding and reordering items in lists in various Process modules. Edit: The reason I'm outputting one JSON file per object rather than just one big JSON file as the built in exporter gives you if you select multiple fields, is that I think it will be better for source version control, especially if a modified timestamp property is implemented for fields, and if there's a need for multiple collaborators on a project. Unmodified object definitions don't need to be regenerated. Additional Edit: Usually a module provides some kind of functionality, but there's no reason why a module can't just exist to install/uninstall a bunch of fields and templates, and otherwise just sit dormant. If it's not an autoload module, it's not going to do anything unless it's called from somewhere, and a module seems like a good way to encapsulate a whole lot of stuff. With the right design around dependencies and inheritance, it should be possible to change 'skins' or 'themes' for a site; something that's not possible with site profiles, as they're basically just a dump of a specific site state. eg, you could have baseModule that installs xyz fields and templates, then themeModule1 and themeModule2 that each provide different front end presentation, but depend on baseModule, so there can be certainty that all the fields they need exist.
  3. I've found what seems to be an undocumented method of the Field class that's used by the built in field import/export that I think could be useful in automation. $field->getExportData() returns details of the object, but needs a little bit more work to turn into a JSON object, but builtin ProcessFieldExportImport shows how to do that. There's a corresponding $template->getExportData() method. I tried this: $testField = $fields->get('headerImage'); echo wireEncodeJSON($testField->getExportData(),true,true); and I got a nice JSON object with the field definition in return. I'm lazy, and forgetful, so I like using the admin UI to build my fields and templates, because it reminds me of all the properties of a field and what they do, right there on screen. Because I'm forgetful, where the UI gets a bit less useful is exporting fields, as I've got to try to remember which ones I changed. Adding a modified property and sorting by this as I previously suggested would help, but if I want to deploy the same configuration to a bunch of sites, manual export/import isn't really scalable. With this, I can potentially be lazy and forgetful, as I don't care how a field is made, I can simply grab it's definition and write to a JSON file, but I don't have to try to remember what fields are required for specific functionality as I can simply provide an array with a list of fields (and templates) required in a module, and let it generate them from the JSON files. I think what would be useful at the core level would be proper documentation for these import/export methods that already exist, and maybe a wrapper function so that it's possible to get directly as JSON data rather than requiring an extra step. eg $field->getJsonData() or something like that. I'm sure these JSON files could also provide field and template definitions for Bernhard's RockMigrations.
  4. Templates have a modified property, but fields don't. This might be a useful and simple core feature to implement that could make it easier for anyone wanting to track changes. The Templates Export function shows the modified field, but it's sorted by template name. For quick manual exports, having the option to sort by modified timestamp would be an improvement. Once fields have a modified property, they also need to have the option to have the export function list them by modified timestamp. I see the base Wire class that everything else in the core extends has change tracking properties and methods, although currently there doesn't seem to be any built in method to enable persisting that with fields and templates when they're changed via the UI. Up to date, I haven't really required the sort of version control others are discussing, but I have a couple of sites now, where I'm looking at bundling up functionality as modules for automated deployment to other sites, and the manual exporting of fields and templates doesn't really cut it, but I've built my data structures via the UI, so having an efficient way to convert that to code that can be used for multiple deployments would be useful. With Visual Studio, I'm used to working with the option of using either visual designers or declarative code to build apps, and either way end up with code that can be included in version control.
  5. The JSON that this feature generates for import/export mostly works for me, however the issue is having to manually select fields/templates via the UI. I notice that templates include a timestamp for when they were changed in the data field of the templates table, but fields don't. If both did, then it should be possible to get fields and templates that have changed since the last build time of a module or template. I use the admin UI, and don't want to write more code than I have to. Specifying what fields and templates that a module depends on in code and letting the system pull a config file with the definition of those fields and templates from the database would be UI friendly, but not rely on having to remember what fields or templates are required for a specific purpose, but not require much code either. This is similar to a database first workflow I have with SQL Server and ASP.Net Core. I can reverse engineer any tables I want from SQL Server to get a class definition, so I don't need to worry if the definition of something was manipulated outside my code; I can always grab the current definition without having to write any code. For those who have a licensed copy of Padloper 1, it's interesting to see how it creates the fields and templates it needs. It appears to be using JSON files based on the field and template import/export feature, but has its own code to import them. With a timestamp and possibly a version number added to the data in the fields and templates table, I wonder if that would make a hybrid UI/code based update model easier to work with? Of course for more complex migrations, RM is more capable, but I wonder if even there, it can grab the field and template definitions if they're exported as JSON?
  6. This is potentially progress, as it suggests ProcessWire is at least being given control. ProcessWire throws an internal server error instead of displaying a message if something went wrong. Maybe check site/logs/errors.txt or exceptions.txt also, if you haven't already, in site/config.php add $config->debug = true; as that should display errors.
  7. Does your Apache install have mod_rewrite enabled? If the home page is loading, but no other URLs are working, it sounds as though URLs are not being parsed. Also check permissions and ownership on directories and files. Directories should be 755, files 644.
  8. Further to this, I've posted a feature request to Github, for a new method getColumns in WireDatabasePDO class, as this would enable: $database->getColumns($table) which would be helpful for getting a list of custom table fields and their types. there's already a getTables method and tableExists method, also a columnExists method, but currently no getColumns. I might be able to have a go at building a module myself to map custom table columns to inputfields, and of course I could write a method myself, but if other people are accessing custom tables, it would seem to make sense to have a getColumns method in the core. Copying the columnExists method, removing the WHERE condition and returning an array of the results rather than a boolean is probably all that's needed to implement a getColumns method.
  9. I resolved the problem in a bit of an odd way. The 'deprectated' version of the module that I was using mostly worked, except links to site admin somehow ended up broken. Soma's module didn't work at all. I was able to patch together some bits from the newer module to ignore admin urls, and that got the older module working again fine on my site(s). It got it working for 3.0.184 but I can confirm it broke again with 3.0.189.
  10. Is anyone else having issues with the @Soma version of this module (or the original for that matter) on the latest ProcessWire build? (3.0.189). I had a ProccessWire install that was working fine with the original module on 3.0.146, but on upgrading it broke. I've tried downgrading to 3.0.184 and upgraded to the more recent multisite module, but multisite still seems broken. The home URL works, and menu links for sub-pages are generated, but clicking on any of them returns the 404 page, and entering any domain other than the 'main' domain goes to the home page of the main domain.
  11. If you're trying to duplicate a site, and don't have access to mySQL, then there are couple of modules that may be helpful. https://processwire.com/modules/process-database-backups/ This one can be helpful if you have an existing ProcessWire installation that's working, but need to restore data from a backup. https://processwire.com/modules/process-export-profile/ This one is useful if you're starting a completely new install of ProcessWire and you want to recreate an existing site structure during the install process. This will include templates, site modules, and page structure. You need to copy the exported profile to the new site profiles directory before you install, so that it allows you to select the profile during the install process. This will recreate the database structure. You will need to be able to set up a blank mySQL (or MariaDB) database and assign a database user with full access to it. There are other migration modules if you have a development site and a live site, and you only want to transfer changes.
  12. If your CSS skills are limited you could use a CSS framework to get you up and going more quickly. ProcessWire itself uses UIKit for the backend admin UI. https://getuikit.com/ Bootstrap is another fairly popular CSS framework https://getbootstrap.com/ The down side of CSS frameworks is that they include a lot of CSS that your site probably won't use, and this can slow your site down, so eventually, writing your own responsive CSS will provide you with better performance, but if you need a fairly quick solution to make the website responsive where someone's already made and tested the CSS, the using a CSS framework can be helpful.
  13. I've been using Bootstrap since 3.x compiling my own customised version from less with 3.x and then SCSS with 4.x I'm yet to jump to 5.x I've taken a look at Tailwind a couple of times, and the good thing is it seems to produce very small CSS, but the process of getting set up to compile a minimised version seems to be more complex and requires more tools than with Bootstrap. That's a one off I guess, and once you're set up then presumably it's straightforward. I do like Bootstrap's components. I'm a developer, not a designer, and when a client asks me "What can you make my website look like?" it's really handy to be able to say, "Here are a set of components you can pick from. I can change the colour, size and position any way you like." That's way easier than trying to explain the intricacies of CSS and that technically, I could probably make their website look like just about anything from dog's vomit to the crown jewels.
  14. ProcessWire is an excellent framework for building just about anything, with great tools for permissions, input fields, and creating data structures. With the Combo and Table profields, it's possible to handle just about any data. These fieldtypes show the potential of ProcessWire to handle SQL tables in a more 'traditional' SQL table format, which leads to one area I wonder might have potential for a new feature. In addition to ProcessWire, I also do some work with ASP.Net Core, and one of the nice features it has is the ability to work with existing SQL databases, so that you can either build your models in the framework, or use existing SQL Tables. While working with any SQL data is possible in ProcessWire, it's a lot more hands on, with less built-in support. InputFields and FieldTypes are separate, and there's no reason why an inputField can't be used for data input for any kind of data, and indeed there are some modules that use inputFields to edit custom table data. What would be an amazingly useful addition to ProcessWire would be a module that allows mapping of inputFields to fields in an arbitrary SQL table without modifying the structure of the table itself. This is something the open source Directus project does by using metadata tables to store data about to display input for existing SQL tables, without touching their structure, but documentation isn't great for that project. I think ProcessWire has all the plumbing in place to enable this kind of functionality, and the Combo fieldtype gets pretty close, but still requires the combo table records to be associated with a ProcessWire page. Obviously, existing SQL tables won't automatically map to pages, which means directly accessing them on the front-end via URL automatically isn't possible, but often this isn't required as they may be for backend use only, or for consumption within a ProcessWire page. The recent support for URL/Path hooks though, means that if there is a need to directly access existing SQL on the front end via URL, it should be possible to create a hook to do so. I think adding the ability to create backend data entry for existing SQL tables would fully complete the ProcessWire philosophy of getting out of your way and not making assumptions about your content. It's currently already best of class in terms of doing this regard to front end presentation, but it's still a bit opinionated about data structures at the back end. This is absolutely fine if you're building a web app from scratch, and works really well in most cases, but there are times where being able to quickly incorporate existing data structures would be useful. To be clear, this isn't a replacement for the existing pages model, as that would be a huge and unecessary task to completely re-engineer ProcessWire, but rather an enhancement that can sit alongside all the good stuff that's already in ProcessWire so that it's possible to get ProcessWire to handle existing SQL data tables on the backend as neatly as it already does with its own data.
  15. I think this was a bug. It affected ordinary repeaters too. It seems to have been fixed in 3.0.180
  16. Nice photos. Do you have any issues with image theft posting relatively hi-res images without watermarks? I have quite a lot of photos on one of my personal websites, but they are scaled down and watermarked, and even then, I've found some of them pop up on other people's websites without anyone asking permission. I inherited a camera club website made with Concrete, and the performance was terrible, and the editing process was horribly easy to mess up even if you mostly knew what you were doing. ProcessWire has nice image handling capabilities.
  17. Oops! Second site was on older version of Tracy. Upgrading to latest got pagination working with Lister Pro with Tracy Logs enabled. Whatever has changed with that panel between versions might give a clue as to why the other two are causing issues.
  18. I think I've located the culprits. Debug mode and Request info panels both seem to trigger the behaviour. I disabled all panels, and then started enabling them one at a time. With either of these panels enabled I get the behaviour, but otherwise things work as expected. Just testing on the other site. Results seem a bit different, in this case Tracy Logs also triggered the behaviour.
  19. Just checked. Yes it's still there, but pagination works in Lister Pro. I've just tested on another site, and there are no console errors, but pagination doesn't work in Lister Pro with Tracy enabled, but does with it disabled.
  20. Thanks @Robin S In the JS browser console, I get an error relating to a service worker I have registered for the site, so that might have something to do with it. Strangely, both modules were working just now, but I logged out and back in and they both stopped working again. The upgrades module never gets past the continue button to load the latest versions of modules, and Lister Pro does nothing when clicking on pages. Disabling Tracy from the Tracy bar at the bottom of the screen without logging out, they both work as expected again. I don't actually want or need the service worker running when on the site admin, so I'll see if I can change its scope so it's only associated with the public part of the site and see if that makes any different.
  21. When Tracy is enabled, the latest Upgrades module doesn't display the list of modules installed/available for upgrade, and with Lister Pro, pagination doesn't work. Disabling Tracy results in these modules working fine.
  22. I'm not sure about using pagination in other situations, but with Lister Pro, it breaks when Tracy Debugger is enabled. Disabling Tracy Debugger causes pagination to work again with Lister Pro. I haven't tested with other scenarios, but if you have Tracy Debugger installed and enabled, and everything else with your pagination seems to be set up correctly, it might be worth disabling Tracy to see if that makes a difference.
  23. There seems to be a new bug in that image fields from a template for image captions and descriptions etc for an image that is used in a repeater aren't getting saved.
  24. @matjazp Is it safe to just overwrite the old unmaintained module with your one? I have a site that has it installed, and it seems to be working, but it is generating a large number of log entries with warnings in Tracy Debugger.
  25. This module works well, but with Lister Pro and inline editing within the Lister Pro table, even with the check box to update on save for this module, file names aren't renamed, although opening via a full edit and saving does work. I suspect the issue might be the way Lister Pro works, but if it's possible to get this module to work with inline editing mode in Lister Pro it would be handy.
  • Create New...