Jump to content

Paul Greinke

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Paul Greinke

  1. Great, than I'll keep using it. Thank you for your feedback!
  2. There have been no updates to this module for a long time. Is it still good to use with 3.0.227 or are there better, more active alternatives?
  3. Unfortunately getArray() only returns the items of the current page in the PaginatedArray. I found out, that my code does actually work in ProcessWire 3.0.200. Only in 3.0.179 I get the behavior I described. So I'll just upgrade I guess. I read in the docs that append() is just an alias to add(). Also they accept PageArrays as the argument. Do you know if import() does anything different?
  4. Thanks for the quick response @Gideon So. Unfortunately this does not solve the problem. I still get an PaginatedArray as the result.
  5. I have a strange behavior when I try to merge two PageArrays. The example below creates unwantedly a PaginatedArray. Could someone explain why? I need the result not to be a PaginatedArray but a normal PageArray. <?php $pageArray = wire('pages')->find('template=release,name%=a'); $pageArray->import(wire('pages')->find('template=release,name%=b')); // $pageArray is now a PaginatedArray ?> I know I could do something like wire('pages')->find('template=release,name%=a|b') but my real case the two selectors are more complex. Why does ProcessWire create a PaginatedArray and is there a way to prevent that or at least to deconstruct the PaginatedArray back into a PageArray with all entries?
  6. Hi there. I was wondering, if there was a best practice to handle file uploads outside of the admin frontend. For example if I had a form were a guest user can put some data including a file. I would like to upload the file on input and process it later on form submit. The problem is, that the user also could choose not to submit the form. That would lead to a bunch of unused uploads. In one project I use the PHP session. I simply create a folder named by the session id. Each time the user enters the page with the file upload I initially wipe all the data form the session folder. But this already does not work, if the user had the form opened in two separate browser tabs. Is there maybe a way to hook into the session invalidation process? Than way I could simply delete the session folder as soon as the session expires. I know I could use a cronjob or even lazycron, but I don´t find this a clean way for my case. Another idea of mine was to use some kind of caching folders. I saw that for example FormBuilder does it that way. But I did not find much information about how the caching works in ProcessWire. When is the cache cleared and how much control do I have? Maybe there is a even better and more convenient way to do it. I'll take any idea.
  7. I stumbled across this post searching for the reason why my module won't create the process page under setup. I tried some suggestions from this threat, but eventually found another solution. I just wanted to share this in case someone needed it. I used the getModuleInfo() function to add a page. I did not prefix my modules name with "Process" but only extended it with the Progress class. The only thing I had to do was calling the parents install() method in my modules install() method. That`s it. Now the setup page is created automatically on install. <?php namespace ProcessWire; class MyModule extends Process implements ConfigurableModule { public static function getModuleInfo() { return [ 'title' => 'My Module', 'summary' => 'A module', 'version' => 1, 'page' => array( 'name' => 'mymodule', 'parent' => 'setup', 'title' => 'My Module', ) ]; } public function install() { parent::___install(); } public function uninstall() { parent::___uninstall(); } }
  8. My bad, I figured it out. In order to work the class only needs to extend WireData. So the following example works. <?php class MyClass extends WireData { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization });
  9. Hi there. I wrote a custom module for one of my projects. In fact I maybe want to use my module in other projects too. In order to be variable and customizable I need to implement some custom hooks into my module. So I can afterwards hook into the my functions in order to modify them to match the needs of the new project. I tried simply defining functions with the '__' prefix. But that did not work. I'm imagining something like the following: <?php class MyClass { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization }); Is there a way to accomplish that?
×
×
  • Create New...