teppo

PW-Moderators
  • Content Count

    2,179
  • Joined

  • Last visited

  • Days Won

    42

Posts posted by teppo


  1. Actually I would recommend posting this as a GitHub issue. It's not really a "problem" per se, but I also don't see any point in storing all those decimals, so they're just unnecessary clutter. Hard to say if Ryan will consider it worth acting on though 🙂

    • Like 1

  2. Well, it might be technically possible, but there's no core support for it, and I wouldn't recommend it 🙂

    In this case you would probably have to modify index.php, .htaccess, and at least some other core files: wire/core/ProcessWire.php, wire/modules/Process/ProcessLogin/ProcessLogin.module, and wire/modules/Process/ProcessPageView.module. Modifying core files is never a good idea, as it makes updating ProcessWire difficult (usually you can just replace certain core files and that's it), and there's also no guarantee that some third party module etc. isn't expecting the core to remain as-is.

    So, long story short: if you really have to, you can of course modify it, but there's no guarantee that things will work as expected afterwards. If possible, I'd recommend developing the ProcessWire site elsewhere (subdirectory, or another domain, or locally) and then replacing the old site in one go. 🙂

     

    • Like 1

  3. Quick update: version 2.0.0 of this module is now available via GitHub. This version includes updated RedBeanPHP library, various new config settings (including the ability to disable automatic setup of RedBeanPHP, and an option for choosing one of the trimmed down library versions with support for specific database type only), and various other updates to the module.

    I've also dropped support for PW 2.x and PHP < 5.4, and updated module requirements accordingly. For pre-3.x or pre-PHP 5.4 users the legacy branch still contains old version of the module.

    • Like 5

  4. Hey @ryan. I'm wondering if it would be possible to set up a repository for the new site, so that we could submit pull requests and report issues there?

    Personally I'd still like to suggest some usability / accessibility related changes and fixes, but currently that's a bit difficult to do – and it basically requires me reporting the issue, and then you having to figure out how to fix it for the site. If there was a repository, we could a) reliably keep track of issues that have been fixed or closed for other reasons (avoiding duplicate reports), b) submit changes so that you don't have to do everything yourself, and c) experiment with the site with ease.

    If the site has features that can't be made public, a repository containing partial site profile would of course do, but the best solution would imho be a full site that we can install locally, makes changes to, build, test for regressions, and so on. Or perhaps you could only share access on a case-by-case basis, since even GitHub now supports private repositories? 🙂

    Thanks for considering this!

    • Like 6

  5. 10 hours ago, adrian said:

    I think this is a super important point!!!

    I'm probably a well-known nay-sayer around here already, but I'm still going to add my +1 to this discussion. I feel that (particularly when it comes to API design) one clean and consistent solution should be preferred, unless an alternative approach provides major benefits. Multiple options only tend to make things more fragmented and more difficult to grasp, and doubly so when you're a new user.

    As such, I'm always thrilled when an update enhances the core somehow (performance, security, scalability) or makes something new possible or more streamlined (in this update valid() and validate(), plus the whitelist feature) ... but I cringe a bit when a new way of doing the same old without (seemingly) notable benefits is added.

    Personally I wouldn't mind seeing the core get leaner in the future, perhaps in 4.x. There are, and always will be, features that should be added to the core (shameless plug: FiedltypeDecimal), but on the other hand alternatives without major benefits or major user base, and modules that may not be particularly often-used should, in my opinion, be stripped out.

    10 hours ago, adrian said:

    I hate to come across critical because I know that even in my own relatively simple modules I sometimes get caught up in going with too many options, so I do realize it's a tricky balance.

    A module I've been working on recently has an "alias" feature (that isn't even that important to the module, to tell the truth), which was getting way out of hand. You could provide its arguments in five different formats, at least, which all required their own handler methods. I was working on this feature on Sunday (once again), and finally got fed up with it, stripped all those alternatives out and replaced them with one unified solution: callbacks.

    Sure, a bit of syntactic sugar might've been lost in the process, but I also got rid of probably 75% of the required code, and the documentation page is now actually readable. So, yeah – I know exactly what you're talking about 😅

    • Like 15
    • Thanks 1

  6. Hi @Guy Verville.

    I took a quick look at TemplateEngineFactory.module.php, and this is what I've found out so far:

    Without modifying TemplateEngineFactory itself, I currently see two options: reworking the preview feature to do something else (though not quite sure what.. perhaps it could define a custom template or something like that), or trying to overwrite current page (to fix the $this->wire('page') reference in TemplateEngineFactory.module.)

    Latter option sounds more feasible, yet I'd have to test this properly to make sure. I don't have a proper setup for that available right now, but I'll see if I can get to that sometime soon. That being said, if you could provide me a stripped down site profile to test this with, that'd make things easier for me 🙂


  7. 20 hours ago, psy said:

    Found this today: Wild, weird and out there, it's a big bonus to making PW sites more accessible... https://websitevoice.com/ 

    Talk to me ProcessWire 😁

    That's a nice find, and I believe that a tool like this would indeed be a nice addition for users that don't generally require a screen reader.

    That being said, those who do require such assistive technology will already most likely have their own individual setups, and a separate tool won't really help – so the accessibility argument is somewhat questionable. Perhaps even misguided, since it may give some folks an impression that this is enough to take care of all screen reader related accessibility needs.

    Accessibility, particularly referring to screen reader users, is not just about enabling "text-to-speech voice for the relevant content" (at least the way I understand their selling point), but rather about making sure that the entire user experience takes screen reader users into account. In other words: providing a read-out-loud button for the main content is not enough, if some users can't even navigate the site with ease 🙂

    • Like 2

  8. Hey @J_Szwarga!

    Is this related to the FormBuilder module? If so, you should really be asking this on the VIP support area. If you've bought FormBuilder, you should have access there – and if not, you should contact @ryan.

    I don't have an answer to your question, but perhaps someone else will be able to chime in, here or on the VIP support area.

    Note: the "Modules/Plugins" area of the forum is for dedicated module support threads only, so I'm moving this post to the "General Support" area of the forum.


  9. On 1/23/2019 at 12:08 AM, Nvim said:

    TDD should be built in Processwire.

    Please be a bit more specific. Why is this so important to you, and how would you envision it being implemented in the context of ProcessWire? Have you considered the possible solutions mentioned in this thread, and if so, what made you decide that they are not good enough?

    We're always happy to discuss new ideas and suggestions, but on the off chance that you're only posting these things in order to cause an argument, be aware that such behaviour won't be tolerated here.

    Thanks for giving your posts a bit more consideration from now on, and have a great day!

    • Like 3
    • Thanks 1

  10. About verbosity: I don't find it inherently bad either. Don't get me wrong – I truly enjoyed reading this post. There's always room for such text, and I love the way Ryan explains things. It just makes sense.

    That being said: if and when someone is only just trying to figure out how the API works – say, they're evaluating a number of platforms, and want to see which one makes most sense – it would be best for both us and them to have a short version available. Key points only: what are the methods they can use to access the API, where and why they should use each method, and finally "read more" -links for more details about each method.

    I've been digging into a lot of new tools recently, and I can say from experience that it makes worlds of difference for a newcomer how fast and easy they can get the basics in. It's the worst if you have to spend loads of time digging into terminology, long posts discussing philosophy and behind-the-scenes implementation, or other things that don't really matter at that point, just to know if this actually is the platform you want to invest your time in.

    It should be an incremental process: start from the basics in an easy-to-chew package, and continue building up from there. You don't want to drop a mountain of information onto a newcomer on one go 🙂

    • Like 9

  11. Quote
    • Not all API variables are available as functions. Only those that are likely to be needed on the front-end of a website or application are available as functions. As a result, it’s a very specific list of functions that does not change based on what modules are installed, etc. (this might also be seen as a benefit in clarity for some)
    • API variables provided by 3rd party modules are not available as functions (other than through the wire() function) unless the module developer has opted to create one.

    The first bullet point seemed to answer my question from the previous thread: module's can't add features to the Functions API, it's immutable in that regard. The second bullet point, on the other hand, seems to contradict the first one: module developers can indeed create new functions for API variables, effectively adding to the Functions API – even if behind the scenes the implementation isn't identical.

    It might be worthwhile clarifying the wording here a bit, I at least found this part confusing. Leaving the "it's a very specific list of functions that doesn't change" part out and perhaps adding "By default" before "Only those that are likely" would be an improvement – unless I'm misunderstanding the whole thing?

    Also, a table of contents would be really nice for these longer pages.

    ---

    Overall I think it's great that there's now documentation for a lot of stuff that was completely missing before. I do agree with @adrian in that the new documentation is a bit verbose, though. It's a lot to browse if I simply want to get the facts.

    My own writing style tends to be extremely verbose, so I should know 😄

    @ryan, would be possible to allow others to somehow make suggestions to the content of the site (and particularly docs) without having to open a new issue for every suggestion? It'd be amazing if we could somehow make some kind of change suggestions and submit them directly via the site, perhaps publicly – or at least for a limited group of volunteer editors.

    Trust me, I do realise that keeping everything up to date, managing the core, writing weekly posts, and whatnot must be an unbelievably time-consuming job. Just looking for ways the community could perhaps participate.

    • Like 7

  12. On 1/17/2019 at 12:41 PM, bernhard said:

    Isn't FormBuilder doing something similar with the iframe-embed method?

    Yes and no: the page those forms are rendered from isn't actually in the admin area. By default it's a regular page at /form-builder/. This page has a template file of its own, and when you access said page, it figures out the correct form and renders it – making use of some stuff bundled with the core for rendering the form and form fields.

    Technically you can do that with any module that produces output: just figure out when and where to render it, call a method that returns output, make sure that necessary styles and scripts are loaded, and output the... err, output. If you need to do something based on user actions, implement necessary endpoints with hooks, URL segments, or based on POST/GET data.

    I'm using something similar in ProcessChangelog for rendering the RSS feed generated by a Process module for front-end users: https://github.com/teppokoivula/ProcessChangelog/blob/master/ProcessChangelogRSS.module#L97:L103.

    ... but that's a really, really simplified version of it, and perhaps not quite what you're looking for yet. 🙂

    On 1/17/2019 at 6:10 PM, adrian said:

    I guess I am talking about the approach that module uses of loading up an admin page in an iframe. Perhaps you could adapt it to your needs to allow access to certain parts as a guest user. Not sure - sorry if I am completely off-base with what you are looking to do.

    AdminBar makes use of the ?modal=1 parameter that Admin supports, in which case header/footer areas are left out of the response. I've used this method for injecting things like profile edit screens into the front-end for registered and logged-in users – though they tend to look a bit off in an iframe, so usually I use an actual modal instead – but it doesn't yet solve the permission issue.

    ProcessWire's permission system is relatively flexible, but as @bernhard already pointed out, there are always risks involved when you tweak such things 🙂

    On 1/17/2019 at 6:16 PM, kongondo said:

    No authentication whatsoever? Surely you don't mean 'free-for -all' editing? I'm sure I'm missing something. Please explain.

    Not trying to speak for Bernhard, but I believe the idea was to utilise the module architecture, probably Process modules in particular, to easily create front-end-oriented tools, so not really free-for-all editing per se. A booking system might be a good example – you may want to give guests a limited access to create new content or perhaps even edit/delete content based on specific set of rules, but this could also be useful for creating non-editable views.

    Front-end listers, anyone? 🙂

    ---

    I think that overall this idea has some potential. Not sure to what extent, or how feasible this would be, but it might be worthwhile creating a small proof-of-concept and trying things out. The permission thing is still a huge question mark, though.

    If I was to build something like this, I'd probably start by looking what ProcessController core class is doing, and how it's used by the Admin itself. Though correct me if I got the whole concept wrong, and this is actually about something different entirely. There may be other ways to use the module system in the front-end as well, but Process modules are basically what the Admin side is made of, so when you say "public backend pages" – well, that's what it sounds like to me 😄

    • Like 5

  13. Literally days before this announcement I needed a private repository for a new project, and registered a Bitbucket account for that. Haven't migrated back yet, but probably will 🙂

    GitHub provides free private repositories for max 3 collaborators, while Bitbucket has a limit of 5 collaborators for a free private repository. Not a huge difference... unless, of course, you're running a team of 4-5 developers and want to save a few bucks 😄

    • Haha 1

  14. By the way, I was just wondering what might be the recommended alternative to defining custom API variables (particularly by modules) for the Functions API? Is there one?

    I for one have found these very useful, as they provide a way for module authors to add developer features that feel consistent with the "native" API. In case custom API variables are only feasible with the non-Functions API, then perhaps that should be documented as well; or am I just overthinking this? 🙂

    • Like 2

  15. 13 hours ago, teppo said:

    (By the way, it seems that the wire-prefixed versions of these were missing from those lists of "all the different ways to access one API variable". Not sure how often people actually use wirePage() etc... but they've probably found their way to some projects out there. And, as is explained in the blog post introducing Functions API and in the FunctionsWireAPI.php file, this version has the advantage (over regular Functions API) of always being available.)

    Correction to this: in the blog post Ryan mentions the wire-prefixed Functions API methods and explains that they have the benefit of being always available regardless of config settings (essentially the same thing that the comments in the FunctionsWireAPI.php file say) – but there is a comment to the blog post in which he mentions that these are actually "for an internal core purpose".

    @ryan, this might be one of the things that should be clarified somewhere: if wire-versions of the Functions API methods are indeed not intended for public use, it should probably be mentioned somewhere (other than a single comment to the Functions API announcement blog post). If one reads the blog post and doesn't check all the comments, or checks the code / code comments directly (which is a common thing to do in our context), this is currently not obvious.

    • Like 5

  16. 15 hours ago, adrian said:

    I've suggested this a couple of times above - making use of the Tracy Console panel - either as is, or more likely using the code behind it to have something that can be embedded in an iframe on the page itself. 

    Right – I might've misunderstood those posts, thought you were referring to the demo site. Probably just me not paying enough attention 🙂

    I've been doing JS related work recently, and found it really helpful how some libraries provide these interactive code blocks on promo sites and/or docs: "here's our example, here's what it does – try modifying it and see how that'll change things." Another use case are incomplete (or even empty) code blocks urging the user to figure out how to produce some predefined output from them.

    Personally I dislike learning from docs alone, so this approach provides the best of both worlds: docs so I don't feel like I have to figure everything out myself, and editable/executable code to give me the opportunity to learn things by doing (and making mistakes along the way) 👌

    15 hours ago, adrian said:

    On the issue of page() vs $page it's actually unfortunate that page() can't be overwritten because I often use the Tracy console in the admin when editing a page. $page is automatically set to the page you are editing, but of course page() will return the "/admin/page/edit/" page. I don't think this is a valid reason to NOT promote the use of page() as the default approach, but it is something to be aware of.

    Now that you mention this, I've done that on a few occasions too. While this may be a bit of an edge case, it's a good example of how something that may seems like an issue at first (overriding API variables by accident) can also be a good thing once you know what you're doing 🙂

    (By the way, it seems that the wire-prefixed versions of these were missing from those lists of "all the different ways to access one API variable". Not sure how often people actually use wirePage() etc... but they've probably found their way to some projects out there. And, as is explained in the blog post introducing Functions API and in the FunctionsWireAPI.php file, this version has the advantage (over regular Functions API) of always being available.)

    • Like 4

  17. On 1/14/2019 at 10:36 PM, ryan said:

    What I'm suggesting is actually much simpler than you think, and is more specific and clear than using exclusively $var or var(). Please wait and see what I write up this week, and I think it'll make sense. Like I mentioned earlier, if you fully understand it and still don't agree about the benefits, then I'll reconsider, but for now trust me on this. 

    I've been following this topic from the sidelines with mixed feelings. I've always considered ProcessWire's API exceptionally clean and easy to understand, and technically that hasn't changed, but I do find it confusing as well that there are so many ways to achieve essentially the same thing – except that some will only work on certain situations (bootstrap, templates, modules, multi-instance, ...) or may have performance benefits or perhaps won't be available on all sites depending on config settings, etc.

    I'm very eager to hear what you've got to say about this, and I'm hoping that it'll make everything crystal clear again 🙂

    ---

    Either way, the tab idea (different approaches in different tabs) is, in my opinion, awesome. Combined with per-tab instructions on where and how to use each approach (could be a tooltip with short summary and a link to full documentation page) this would be a huge improvement. If functions API calls are shorter, then show those by default – it won't take anything away from the marketing / functions API promotion perspective, and it may in fact give users a better understanding of what they're missing if they're not using the functions API.

    ---

    On a completely different topic, one thing I've been wondering is if it would make sense to provide some kind of "interactive editor" for the API features – "tweak the code and see the result here". I know, ProcessWire isn't a JavaScript app, and the API has loads of stuff that wouldn't make any sense to implement in JavaScript, but perhaps as some kind of a virtual box (not sure how one would set that up securely, though) or a limited scope JavaScript mock API with a set of mock data behind it?

    Just an idea for now.

    • Like 3

  18. @flydev, thanks for linking that thread – I had already forgotten the whole thing. Will come in handy for a project I'm currently working on 🙂

    That being said, TDD or test-driven development is a pretty specific process: essentially you define what the app should do (success criteria), create tests based on that, and finally write code to fulfil those tests. Iterate this until you have a complete application. I haven't heard anyone developing ProcessWire stuff like that, but technically it's doable, although it obviously depends a lot on what you're actually building with ProcessWire.

    For most sites out there I'd argue that TDD probably isn't the easiest thing to pull off, or perhaps even the most sensible approach. In my opinion it's more suitable to application development. The front-end layer alone adds loads of complexity to the equation. I'd love to hear if anyone is actually doing this in our context though 🙂

    • Like 2

  19. 45 minutes ago, adiemus said:

    It starts with a http 1.1 get request for the admin page (/processwire).
    Next request is a http 2.0 get for /processwire/login.

    This part sounds somewhat curious. HTTP 1.1 request to /processwire (seems to work), then HTTP 2.0 request to /processwire/login (doesn't work) – is it possible that the server is not properly configured to handle HTTP/2? What happens if you directly request /processwire/login/, i.e. type it to the address bar instead of /processwire/?

    Also, just to clarify: when you enter /processwire/ you get the error for /processwire/login/ right away? You didn't even see the inputs for username and password? If so, it might also be that there's something in the site or browser cache that breaks things.

    If your site is using default session management, i.e. files on the disk, you could start by clearing /site/assets/sessions/ of any session files currently in there. Also make sure that there's nothing odd in your browser cache by clearing that as well, or opening the admin in an incognito tab or something similar. If you've enabled database sessions, you'd probably have to clear them manually from the related database table (haven't used this feature, so not sure how exactly).

    By the way, the certificate error doesn't sound too good either. Did you have a certificate set up on the old server, and can you set up one on the new one as well? Although this seems unlikely, one possibility is that the server isn't properly serving HTTPS content.

    This is somewhat off-topic, but it seems really strange that a hosting company (assuming that this is the case) moves the site to a new server without informing you, and without providing proper support, or even making sure that things work as expected after the move. When that kind of thing happens, you might be better off looking for a new hosting provider. Just saying.

    • Like 1

  20. 10 hours ago, kongondo said:

    Not sure if this is still the case, but there have been reports of docker being slow on Macs, generally (as well as when tty = true. => not sure about this though).

    Sadly I don't have an answer to the issue raised here, as I have only just started to play with ProcessWire and Docker, but I've got a very similar setup on a MacBook Pro (4 GB RAM and 6 CPU) for WordPress development – and I have to say that it's often painfully slow. This does seem to be a relatively common problem, at least for Mac users.

    That being said, I'm running a fairly non-standard and complex WordPress stack, so it may strictly speaking be something other than the WP core which is the root cause – ACF or any of the other plugins, something in the theme, etc.