Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. Hey, just noticed right now that this is a swiss powered discussion Have a nice weekend! Cheers
  2. A small addition to kongondos example: If you only need to get the count, you should use $pages->count("selector") because of performance reasons. The count method does not load the page objects.
  3. Hi lindquist, That's a good solution you've come up with. If you want to provide an API variable for your object, here's an example, pretty easy like everything in ProcessWire: // This must be inside an autoload module public function ready() { $this->wire('calendar', new Calendar()); } // Or, if you're Calendar module is autoloaded, make the same instance available as API variable public function ready() { $this->wire('calendar', $this); }
  4. Yep, If I remember correctly, you can't refer to "$this" in a closure. But you could use wire('session') to get the session object there.
  5. Ok you're right. But I guess this would work only nice for parameters that are passed by reference, which in PHP are objects. Parameters like strings/ints are passed by value (unless using the prefix "&"). If an event listener does change the value, this does not affect the variable in the actual method. Maybe I still don't understand what you mean
  6. There is a bug somewhere which makes modules dissapear, in your case it's probably the "LanguageSupportFields" module. Please see here: https://github.com/ryancramerdesign/ProcessWire/issues/1011
  7. @owzim Here you go: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/HookEvent.php#L144 PHP's reflection is the secret, like you already guessed
  8. I usually executed such scripts over the command line (bootstraping ProcessWire). Maybe you could use Hanna Code if you'd like to write the code in the admin?
  9. Interesting discussion! For me (as a developer), the advantages of ProcessWire's hooking system overweight the issues you mentioned. I agree, it's sometimes harder to find the relevant piece of code, because it gets added dynamically with hooks. Debugging is definitely harder too. But in my opinion you can never achieve the same flexibility with events. For example, how would you handle the beforeHooks, which are executed before the "real" method is invoked? How would you modify the passed arguments? Also the afterHook can modify the return value. It's so powerful and easy to do - just add those three little underscores and you can use this power in your own Wire-derived classes. I like
  10. Hi quickjeff, You can create a permission "role-admin" and give your admin-role this permission. Any admin should then be able to manage roles. Note that I've not tested it myself, but found this comment: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessRole/ProcessRole.module#L26
  11. I would go the javascript route, it's a one-liner in JQuery
  12. Thanks for your feedback Jürgen! I've tested myself and didn't find any bugs, so i merged into master. Meaning that v. 1.1.2 is now official As described two posts above, this version adds support for multilanguage PDF files. Please make sure that your PDF files are still generated correctly before you update on a live site! Cheers
  13. Hi, Looks like PDO support is not avaialble. Does ProcessWire work fine outside of the interactive shell?
  14. What version of ProcessWire? Any hints in the error log (site/assets/logs) Do other fields work fine in the repeater?
  15. Hi, I have implemented the feature and it's available in the dev branch: https://github.com/wanze/Pages2Pdf/tree/dev If anyone has time to test it out, please do so and report any issues back here. I will merge it into the master branch after some more testing How does it work? First, you need to enable multilanguage support in the module configuration. If enabled, the module creates a PDF in the language of the current user. The same is true when downloading a PDF. If the PDFs are pre-generated when saving pages in the admin, a PDF for each language is created. The language name is appended to the PDF filename in order to distinguish between files of different languages. In addition, if the module "LanguageSupportPageNames" is installed, the local page name is used for the filename. At the same time I added the newest version of mPDF to the module WirePDF. As always, please check that your PDFs are still rendered correctly after updating! Good night to everyone from Switzerland
  16. I had a similar problem yesterday with one of my modules (Pages2Pdf). Suddenly the module was no longer listed and also not installed. I'm using the module in a template and this was resulting in a fatal error, because there was no object returned by ProcessWire. I'm not sure what caused the problem, I was installing some new modules before. Things I tried: Clear modules cache via admin Clear modules cache manually None of this did help. The module was still in modules table in the database. After deleting it there, it appeard again in the admin and I did a "fresh" install.
  17. Hi Juergen, I'm the maintainer of the module. You could solve it by hooking after this method and return a PDF filename that depends on the language of the current user: https://github.com/wanze/Pages2Pdf/blob/master/Pages2Pdf.module#L454 I could make this method hookable for you. But I think supporting multilang would be a great feature for the module, I might need this myself soon. I'll find some time this weekend to implement it. My approach would be to create a new configuration option where you can select for what languages the PDFs are generated. When requesting a download, the PDF in the language of the current user is served. Cheers Edit: Could you post module related questions in the official module thread? Thanks. I'll try to merge them
  18. ProcessWire performs a redirect if your URL where you send the form doesn't have a trailing slash. Is this the case? You can also use DevTools in Chrome or a Tool like Firebug and check what's going on with your request. Cheers
  19. Hi Stikki, Thanks! Please report any issues or new features you'd like to see here! Never thought about that, have you tried it?
  20. You're welcome! I don't know what happened, this sounds strange. But you could try to create the table manually. Here's the SQL statement from the module code: https://github.com/apeisa/ProcessRedirects/blob/master/ProcessRedirects.module#L326 If you have phpMyAdmin installed or any other MySQL database administrator, execute it there. CREATE TABLE ProcessRedirects ( id int unsigned NOT NULL auto_increment, counter int unsigned DEFAULT 0, redirect_from varchar(255) NOT NULL DEFAULT '', redirect_to varchar(255) NOT NULL DEFAULT '', PRIMARY KEY(id), UNIQUE KEY(redirect_from) ) ENGINE = MYISAM;
  21. It looks like you have Anti's ProcessRedirect module installed but the table is missing. Maybe you can uninstall/install ProcessRedirects again, but make sure you don't loos the redirect rules. I don't know the plugin myself If you don't need it, just uninstall the module and the error should be gone. Cheers
  22. Some possibilities out of millions You can set the page to hidden and it won't appear Don't generate your main menu dynamically Create a checkbox field "Display in MainMenu" and only show pages that have checked it Create a checkbox field "Don't display in MainMenu" and don't show pages that have checked it .... Cheers
  23. Almost You need only one remote repository where the code lives, but with two branches. It's the same git model as ProcessWire uses: The master branch contains the latest stable code, whereas the dev branch contains all the new features. Live Website (e.g. www.yourdomain.com): - master branch is checked out, to get new commits from origin: git pull origin master Test Website (e.g. dev.yourdomain.com): - dev branch is checked out, to fetch the new commits: git pull origin dev Yep, but totally separated, not the dev version inside a sub folder. Also separate databases.
  24. I would setup a live and test installation. The test installation corresponds to the "dev" branch in GIT, where the development continues. If the client needs to check the current state during development, you can pull on the test server. Once the development is tested and ready to go live, I merge into the master branch and pull on the live server.
  25. Would you use this as developer? Because if your end users choose files to upload from their local computer via a form, they are uploaded through HTTP on the server. If you write code to upload a known (big) file from A to B via FTP over PHP, the execution time for your script must be high enough. Cheers
×
×
  • Create New...