Jump to content

szabesz

Members
  • Posts

    2,846
  • Joined

  • Last visited

  • Days Won

    17

Everything posted by szabesz

  1. Yes, that is true but since the functions called by the hooks are not to be called directly on a page object, is it that important to "pretend" that they could be called like that? I never use Tracy's "hooks triggered" section. In what scenario you take a look at it, regarding your own code? I am just asking to learn from your experiences... Anyway, if we use an object method as opposed to a static method, perhaps that method should be protected as it is not intended to be called "from outside". What do you think?
  2. I think that is why you "mix things up". You do not need to use $this just to attach a hook in this context. We do not get access to a page object in the hooked function via $this, instead we use $event->arguments(0). This is because strictly speaking these are unrelated code bits. Sure, organizing them under the class is very useful, but even though related functions are neatly organized this way, the methods attached by the hook live in a completely different context than the ones that are meant do be called directly via a page object. I hope I could clearly explain myself... Are you referring to $site = new ProcessWire('/path/to/www/'); perhaps? See: https://processwire.com/blog/posts/multi-instance-pw3/#using-multi-instance-in-pw3 In that case the site instance in question must be accessed via the variable the reference is store in (via $site in this example) which is a special use-case for sure, but are you really sure that what I proposed would not work in that context? Sticking to Ryan's example, if we do $site->pages->get("template=quote")->init(); then we already got the right context, so why would putting wire() in that init() method not work which is a different context? Again, we are merging different contexts under the same PHP "class code" and we need to keep in mind which context we are in because they are not the same.
  3. Can't you just use wire() instead of $this->wire? What we are talking about is not a "module context", after all. I always use wire() when not dealing with a module.
  4. Hello @bernhard! Thanks for sharing! Great and informative. Though, for complete newcomers to PW it might not be detailed enough, but if someone does not understand something then they can always ask :) BTW, your init() method is not static. Is there a reason for that? Since $pages->get("template=quote")->init(); returns the first such page PW finds, it does not matter which page is that. If it does not matter, then a static init() method would also do the trick, wouldn't it? At least it works for me that way, too. This init() method of yours does not initialize a page object as such, instead, it can be used to organize code which attach hooks related to the template class in question, and not related to a particular page (object). When dealing with a page object in the hook's functions, then that is a different matter, of course. Or is there anything else that (apart from attaching hooks) you sometimes put in this init() method?
  5. BTW, haven't you considered using PW's $session API variable instead? You could simplify your code considerably.
  6. Yeah, later on I realized that I had been a little bit late to the party...
  7. I think @fruid wrote a good short introduction above, he just missed a short "birds-eye view intro" explaining the bigger picture. I skimmed through the code of the module(s) and it is not that hard to see what the module does in general. If someone is really interested in it, then it is best to install it on a site that loads UI-Kit 3 and try in out. What @fruid could really add to his intro above is a short video, showcasing what the module does in action.
  8. As we all know, Google's services are never free, we all pay by providing our own data to them: https://thehackernews.com/2022/01/german-court-rules-websites-embedding.html and we never know what they are using our data for, but this monkey business is quite profitable for them for sure.
  9. Hello, see: https://processwire.com/docs/front-end/output/markup-regions and https://processwire.com/talk/topic/23641-markup-regions-pw-vs-data-pw-different-behavior/#comment-201538 hope this helps
  10. @kixe Thanks for sharing the module! Is there a related github issue perhaps? The only decimal field related issue is this one (as far as I know): https://github.com/processwire/processwire-issues/issues/1341
  11. If you are OK with linking to posts of this forum, you could just simply include a line or two like: "You can read more about realted topics at 'here' and 'there' etc..."
  12. Old question but I have just had to do the same so for those looking for this answer in the future, you might want to do something like this: https://stackoverflow.com/questions/16251625/how-to-create-and-download-a-csv-file-from-php-script#answer-54433375 The key parts to implement are: the headers, handling the output buffer, fopen( 'php://output', 'w' ), and exiting at the end. The rest must be implemented as you see fit. EDIT: it might be better to export data into an excel file, for example when non-ASCII characters are in the text data. I found this package to export to excel with only two lines of code: https://github.com/shuchkin/simplexlsxgen (for CSV see its sister project https://github.com/shuchkin/simplecsv) $xlsx = SimpleXLSXGen::fromArray($array2D); //the array to be expored is prepared in advance $xlsx->downloadAs($filename); //initiates the download
  13. Some notes on this topic: The example above in the spoiler does not seem to work as expected (ProcessWire 3.0.184). What works for me is this: https://github.com/processwire/processwire-issues/issues/675#issuecomment-420958397 Also worth reading this discussion: https://processwire.com/talk/topic/19781-issue-with-hooking-processpagesearchexecutefor-and-the-new-search-feature-in-pw-30108/
  14. Note: the variable $process is undefined in my case, running PW 3.0.201. I used this instead: $page = $event->object->getPage(); // Page that was edited/saved
  15. Something like this is already supported by @adrian's Module Settings Import / Export module which I recommend.
  16. Besides being able to format docs easily and without too much confusion, the editor should be as "lightweight" as possible, JavaScript-wise. I mean that PW should be able to load a lot of editors into – for example – repeaters without ajax loading. Ajax loading should be a last resort option, let's say when more than 50 / 100 (perhaps?) editors must be loaded by a page.
  17. I would rather see CKE4 being replaced with https://easy-markdown-editor.tk/ as I and my clients really don't like the complexity of CKE4, and CKE5 is even more complex than version 4. I know that Easy MarkDown Editor is not as WYSIWYG as CKEditor but I could never set up CKEditor to be a true WYSIWYG editor anyway. Maybe it just my fault, I don't know. Anyway, at least Easy MarkDown Editor could be added to the core as an additional option. So in the end there would be CKEditor 5 and Easy MarkDown Editor, both being integrated as much as possible.
  18. To those who liked it: please do not forget add your thumbs up to the GitHub "issue".
  19. Hello @adrian, I have just upgraded and old site along with this module. So I started to get lots of Unknown column 'field_user_phone.data_country' entries in the log. After seeing all those log entries I came here, just to find this old warning of yours. If I'm not mistaken, I should now update the database manually, but how? Could you please help me out?
  20. Thanks for the info! I cannot answer that but a search engine that does not even list processwire.com on the first page is weird: https://yep.com/web?q=ProcessWire for this query, I get "processwire.com/blog/posts/pw-login-for-facebook/ " as the 19th item in the search result list, and that is the closest thing to finding "processwire.com". Sure, "github.com/processwire/processwire" on the top of the list but still...
  21. This one looks cool: https://www.autohaus-bendel.at/fahrzeuge/300862-citroen-citroen-xm/ Nice site, BTW!
  22. Part two with "Adding in relevant 3rd party or Pro modules" would certainly help newcomers as well, in addition to "Optimizing settings in /site/config.php".
  23. Like caniuse.com but for PHP, eg: https://caniphp.com/?s=null It is possible to support the project: https://ko-fi.com/magicroundabout https://github.com/rosswintle/can-i-php Happy coding! :)
  24. +1 I am working on my first Unpoly driven frontend and loving it so far. With so little code one can do a lot! What I'm aiming at the most is this: no businness data validation / calculation / transformation / whatsoever on the frontend, only in PHP at server side! A lot of "hidden" features are lurking in the Unpoly docs, reveling that things can be quickly implemented by applying a few HTML attributes only, see for example "dependent selects": https://unpoly.com/input-up-switch Unpoly is what Bootstrap is for CSS but for JavaScript, so to speak.... This is an important remark, I think. What they solve (including Unpoly) is not exactly that, but one can code all the "businness data manipulation" on the server only, and use these JavaScript libraries to implement an app like behavior in the browser relatively easily (especially in the case of Unpoly). One still needs to find the "right" backend framework/CMS/CMF that fits ones need and implement the HTML rendering for the frontend as required by the chosen JavaScript framework.
×
×
  • Create New...