Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by porl

  1. @bernhard I have started a quick test and so far so good. The wikimedia fork is structured differently but I copied the "lib/Less" directory into the RockLESS one (so there is /RockLESS/Less) and modified the RockLESS.module.php file as follows: diff --git a/site/modules/RockLESS/RockLESS.module.php b/site/modules/RockLESS/RockLESS.module.php index a711627..fd455da 100644 --- a/site/modules/RockLESS/RockLESS.module.php +++ b/site/modules/RockLESS/RockLESS.module.php @@ -23,7 +23,10 @@ class RockLESS extends WireData implements Module { public function init() { // load less.php if it is not already loaded // a simple require_once does not work properly - if(!class_exists('Less_Parser')) require_once(__DIR__ . "/less.php/Less.php"); + if(!class_exists('Less_Parser')) { + require_once(__DIR__ . "/Less/Autoloader.php"); + \Less_Autoloader::register(); + } } /** A quick check and the RockSkinUIKit module loads and executes with no more errors. I'm not using the RockLESS module beyond that in this project but I assume that is a sign that it should work as expected.
  2. Hi there I made a change in core/WireInputData.php to allow for a config option to allow multidimensional arrays (created a pull request as below). https://github.com/processwire/processwire/pull/161 I posted this in another topic but realised it hadn't been visited for over a year, so thought I'd start another. I understand the reasoning behind keeping the arrays one dimensional by default, but rather than resorting to having to use raw $_POST arrays etc. I thought a useful compromise would be a config variable to enable the behaviour override. To use, just set $config->wireInputMultiDimensional to true. @ryan is there any chance of this being pulled (or a cleaner/better version)?
  3. @bernhard I'll be happy to when I get a chance. Unfortunately I'm in the middle of a project I have severely underestimated time-wise so I'm not sure when I'll get to it sorry. If you don't get anything useful from me in the near future make sure to ping me again and I'll try to get back to it!
  4. @bernhard I definitely think a more active fork makes sense. If one of use were to fork it for this one-off I think a similar problem would just happen again in future.
  5. I made a change in core/WireInputData.php to allow for a config option to allow multidimensional arrays. https://github.com/processwire/processwire/pull/161
  6. Hi @ryan No problem, if you think it is useful!
  7. Success!!! Completely cleared out everything, rebuilt the field from scratch, readded to the template and now it is working. Very strange that the whole function worked except the delete/insert statements seemed to be ignored, but for whatever reason recreating it all again works fine now. Thanks again for all your help, I truly appreciate it! Whilst I would have preferred a variant of the Table field for my structure I can work around this one. Sometimes perfection gets in the way of things!
  8. Gahhh!! I really can't understand what is wrong. I added some tracy debug lines through the process and all the way to the database call in the addMatrixData() function everything looks good. This is the sql that is built: My original array had 'f' for the 1092/1076 item and this is showing that my test message is replacing it in the sql. The result of the $query->execute(); statement is true, so the database isn't giving any errors. But there is no change to the database!! Saving changes from the back-end works fine, just not using this method.
  9. Hmm okay, will do then. I might clear out everything I've had previously and start fresh. I may have something else somewhere interfering (can't think what it would be, but who knows). Thanks again for your help. Hopefully I can get this!
  10. Still doesn't work unfortunately. Not sure what is wrong with my setup. Maybe I'll just have to resort to using SQL 😞
  11. Passing the $page variable to the addMatrixData() function gives an "Integrity constraint violation: 1062 Duplicate entry '1092-0' for key 'PRIMARY'" error (1092 is the page id of course). I also saw that it was requiring an int so I assumed that it actually wanted $page->id. Unfortunately whilst this removed all the errors, now it doesn't store anything any more. Test code is as follows: Am I doing something wrong? 1092 and 1076 are both valid ids for the column/row pages (yes, I know 1092 is the page itself, I've had no other issues with this and my page selectors just happened to include the original page in my test site).
  12. Hmm doesn't seem to work for me, although I had to use the example you had in the original thread with $matrix->add rather than $matrix->addMatrixData since it complained that method doesn't exist. Using this it just adds duplicate values. Am I running an old version or something? Can't see this method in the github repository either. Looking through the old thread messages I saw you asked a similar question at one point but the answer then was to use SQL. Do you know what was changed after that?
  13. One more question: I can now get the Matrix data to be added as you suggested, but is there a similar method to update already existing values (without just writing SQL)?
  14. Gah! Thanks, I read through the whole thread a few times but somehow missed that. I think after reading a certain number of posts over and over your mind just goes blank. I suspect you are correct about the Table module being a bit more difficult to work with. I guess I'll have to think of a way to work with the Matrix module and just create pages for each row or something similar.
  15. This is what I posted on the Matrix module thread. I'm still not sure that module would suit though, as I believe I need to use pages to create each table row(?). What would be ideal would be the ability to programatically create columns based on pages (like Matrix can) but rows just function as normal rows in the Table module. This is why I thought it might be "cleaner" to somehow use the Table module but automatically create columns by matching some selector or page select field. I tried browsing the code to see if there was a method I could hook or something but it is all a bit beyond me. I also thought maybe I could look at the Events module and create something more custom that uses a selector to determine columns, but again, I wound up feeling out of my depth.
  16. How can you get that to work in the front-end? I get errors trying to instantiate the Matrix() class. Not sure what I'm doing wrong.
  17. Hi all I've been trying to find the "perfect" module to allow me to store a table of data where the rows are manually created but the columns are generated from a selector. I tried playing around with the Matrix field but it didn't quite suit and there is not much support for entering data from a front-end form (API wise I mean, I don't mind building the forms manually). I realised the only thing the ProFields:Table field is missing is the ability to create columns from other data sources. The api works really well for what I need, but I would need to make a custom version of the field for multiple "products". If I could have a built in multi-page select field to generate these columns then each product page could have these customised columns without excessive work. Is there a way to "extend" this module to change the repeater-like interface to one where the columns are selected from, for example, an ASM multi page select field (or even just a text entry selector)? I'm not expecting this to be added to the core of the module as I don't know if it would be useful to others, but I'm a little out of my depth making a similar module from scratch!
  18. Hi again. Further to my last question, how do I use the class in the front end? I tried to copy the snippet with $matrix = new Matrix(); but it couldn't find the class. I tried to add the Matrix.php as a require_once line but now I get an error stating WireData cannot be found, so I assumed I need to instantiate the module some other way. I then tried to use the $modules->get method to load the module and changed new Matrix() to new \Matrix(). This seemed to load the Matrix class now, but it now complains with the following error: Class 'MatrixArray' doesn't yet implement method 'makeBlankItem()' and it needs to. I don't get this error when using the module in the back-end so I assume there is something else obvious I am missing.
  19. Hi there. I'm trying to work out if this module will suit a site I am working on, but I'm not sure how to add items via API. I saw your code snippet, but is there a way to modify individual elements rather than adding to them? What I mean is something like $row = 1024; $column = 2048; $value = "hello, matrix!"; $matrix = $page->matrix_field; $matrix->set($row, $column, $value); or similar? The dynamic nature of the row/column generation is perfect for my use case, but I will be needing to modify "cells" from the front end and not sure if this is how this module is designed to work or if I am just missing something obvious. Thanks!
  20. Looks like it might have been specific to the Twig module then. Yes, auto rendering is nice and handy but sometimes gets in the way. I made my Judo/BJJ club's site as a single-page website but wanted to keep all the partials separate and combine them dynamically. It was trivial to pull pieces from wherever I wanted with auto rendering off but when I hit that bug (and was on a tight timeline so couldn't dig into it more) I had to restructure to allow the auto rendering to be on. Not as clean but still worked okay. I'd imagine in more complex setups it would be harder to work around if it wasn't an option!
  21. Nice! I was tempted to try the same just to see what was involved. Definitely curious to check it out! On a side note, can you see if it works with the "auto render" option in TemplateEngineFactory off and with '%' characters in the markup (outside of the latte tags)? I found this bug with the Twig render engine but not sure if it is specific to the Twig module or the Factory part itself.
  22. Hi all I am currently working on a custom orders site for a client. One thing that I'm racking my brain over is how to structure some fields that seemingly require relationship with other pages. Not sure how to describe that properly so here is the basic idea: Templates Product types (self explanatory) Customer (also self explanatory, likely custom user pages but could be separate if necessary) So far so good. Now, each product type needs an image field. The tricky part is that each product's image field needs to have the ability to have a different image for each customer (the orders are for unique customised items and the site will display images of how they will appear). My current thought is to make the product_image a repeater that holds two fields for each item: an image field and a page_ref filtered to the customers. It could also be reversed - customers have the image repeater containing the image field and a page_ref to the product types. Is there a cleaner way to do this? Ideally I would like to have a field that is a table of some sort that automatically shows all the customers and you can assign an image to each. I thought of making a custom field like this but then felt out of my depth - what to do when a customer is deleted for example? Is there some field module that has some ability to load a reference to other pages or something like that? Or some way I can easily "hook" the repeater field/table field etc. to do a "foreach" of current customers (that wouldn't fall apart if the customer list changed)? Of course I can do it with my current thought, however I felt this is not intuitive for an end user (they would need to go through any page list to make sure they got every one for instance) and since so many people here have clever ideas I thought I'd see if there was any other approach.
  23. Where did you get the Less compiler part from? I noticed some warnings from php regarding the use of "continue" rather than "break" in some switch statements (functionally identical but continue generates a warning). I saw they were from the less.php/Less.php file and was about to patch them, however I was curious as to whether this was imported from an external library or you rolled your own. If external then I would imagine it more useful to fix it upstream first. I did a brief search for "less.php" but didn't find anything that seemed to match your project file's structure.
  24. I would suggest using the blog site profile as suggested above, even if just to learn your way around. Once you get a feel for it you will see it is relatively straightforward to set up the ability for a user to make a specific type of page (post/portfolio item etc.). Starting with the blank profile makes sense if you already understand this process and want to build something very different. The site profiles are pretty flexible and serve as good starting points for everything else (including what I feel you want).
  • Create New...