Jump to content

kixe

Members
  • Posts

    803
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by kixe

  1. foreach ($page->produkt_repeat_field as $building) { $image = $building->r_galeria_image->first(); $thumbnail = $image->size(450, 250); echo "<article>"; echo "<a href='{$image->url}' class='fresco' data-fresco-caption='{$image->description}' data-fresco-group-options='preload: [1,2], effects: {spinner: {show:150, hide:150 } }' data-fresco-group='kolace'><img src='$thumbnail->url' alt='obrazok'></a>"; echo "</article>"; }
  2. It's not possible to set the following attributes via setOptionAttributes() function: value, checked, selected. https://github.com/processwire/processwire/blob/51629cdd5f381d3881133baf83e1bd2d9306f867/wire/modules/Inputfield/InputfieldSelect.module#L612 If you want to dynamically change a page field value: $page->selectfield = array(1030,1031);
  3. @bernhard https://all-inkl.com/ https://kasapi.kasserver.com/dokumentation/ I wrote a PHP class (SOAP API client wrapper) which is used by the ProcessWire module KasProcessEmail to connect with the API.
  4. I recommend to sanitize the input $moduleFilter = $sanitizer->pageName($input->get('f'));
  5. // find pages and sort $pages->find('sort=firstsortfield,sort=secondsortfield'); // Sort WireArray from newest to oldest $items->sort("-created"); // Sort WireArray by last_name then first_name $items->sort("last_name, first_name"); https://processwire.com/api/ref/wire-array/sort/
  6. It's not the same situation, but maybe interesting in this context. I work for a professional association with around 2000 members. Until recently the association had rented a root server to host web content, member management and email accounts for the members. Now we have switched to shared hosting including all the e-mail accounts. The members now can independently activate and deactivate their e-mail accounts via a ProcessWire interface (API to hoster) and further administrate via the webmailer provided by the hoster. The member management was transferred to an external cloud based service. Result: lower costs. less work (administration and support). Outsourcing responsibility for security and administration. The members are satisfied.
  7. // for editing $this->addHookBefore('ProcessPageEdit::execute', function($e) { /* ... */ }); // if page template = user $this->addHookBefore('ProcessProfile::execute', function($e) { /* ... */ });
  8. Notice. The script doesn't work with $config->pagefileSecure = true;
  9. I am not a guru, but: When you access $object->property, a magic __get() method is called that returns a copy of the value of this property. If the value is an array and you try to add an item, only the copy is affected, not the original property value. For this reason, an error message is displayed that your attempt to change the value has no effect. The magic __set() method must be used to change the (whole) value of the property. Both ways (yours and @horst 's) are fine to set the value.
  10. As far I can see you handle only the array version of the get parameter 'level', but not the pipe separated version. I didn't tried it out, please check: if($input->get->level) { if (is_array($input->get->level)) { // Level is an array. Code adapted from Ryan's snippet here: // https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/?tab=comments#comment-38042 $level = array(); foreach($input->get->level as $id) $level[] = (int) $id; // sanitize to INTs $level = implode('|', $level); // convert to 123|456|789 string, ready for selector } else $level = "$input->get->level"; } else { $level = ''; } @flydev ?? ... one second quicker ?
  11. @ttttim I have added new Fieldtype Select Color Options to FieldtypeColor package. Read more here: Furthermore, as @elabx already mentioned, if you use Spectrum Color Picker as Inputfield in FieldtypeColor it is also possible to configure it to a select with predefined options: https://bgrins.github.io/spectrum/#options-togglePaletteOnly
  12. I have added Fieldtype Select Color Options to the package. Read more here:
  13. @Hurme This looks like you have choosen the wrong input type: For your needs please use SpectrumColorPicker as Input and add the following code showAlpha: true, showInput: true in the color picker options field. This setup will provide something like:
  14. I have added a new field type to the FieldtypeColor package. It is still in beta, but is already working quite well. The module is an extension of the Core FieldtypeOptions module and offers colors as predefined selectable options via 4 different input field types (Select, SelectMultiple, Checkboxes and Radios). Please try it out and if you like it, recommend it in the modules directory ? 2 Screenshots
  15. You need to enclose the api vars with curly brackets if there is more than one arrow in it. echo "<img src='$front_img_800->url'>"; // good echo "<h2>$item->front_productpage->title</h2>"; // bad echo "<h2>{$item->front_productpage->title}</h2>"; // good Read more: https://processwire.com/talk/topic/4439-when-do-we-need-curly-brackets/ https://www.php.net/manual/de/language.types.string.php#language.types.string.parsing.complex
  16. ... indeed ... For some other page reference inputfields like radio buttons or checkboxes the following hook example could be a first approach. I use it for a field to select a system user. Each label is preceded by a user icon. It should work for checkboxes as well. You need to hook in InputfieldCheckboxes then. $this->addHookBefore('InputfieldRadios::render', function($e) { $input = $e->object; // quick exit if ($input->name != 'clients') return; $options = $input->getOptions(); // $key = page ID foreach ($options as $key => &$label) $label = "<i class='fa fa-user'></i> $label"; $input->setOptions($options); }); $this->addHookAfter('InputfieldRadios::render', function($e) { // quick exit if ($e->object->name != 'clients') return; $e->return = wire('sanitizer')->unentities($e->return); });
  17. $product->of(false); $product->title = $productTitle; $product->save(); in short: $product->setAndSave('title',$productTitle);
  18. Steps to solve this: create .js file which sends your sort criteria via form and receives the updated page list. Reload page or update content (ajax) get the input (sort criteria) via PW API: $input->post sanitize your input select pages from DB $pages->find('template=xy, parent=xy,sort=criteria1,sort=criteria2, ... and so on); render updated list.
  19. This problem is still not solved. Strange results: // check if field is empty (NULL) $p = $pages->get("datetime="); // SQL Error $p = $pages->get("datetime=''"); // SQL Error $p = $pages->get("datetime=0000-00-00 00:00:00"); // SQL Error $p = $pages->get("datetime=0"); // expected result, will find a page with datetime = 1970-01-01 00:00:00 $p = $pages->get("datetime=null"); // will find a page with datetime = 1970-01-01 00:00:00 why? var_dump($p->getUnformatted('datetime')); // if a page exists result -3600 due to the locale I need to check if the field is not set via selector. Any ideas? Currently I exlude this from the selector and loop the results (bad solution) https://github.com/processwire/processwire-issues/issues/973#issuecomment-625678587
  20. With FieldtypeColor https://modules.processwire.com/modules/fieldtype-color/ you have multiple options for the Inputfield: Text, HTML5 Color, any Javascript ... If you are able to create a custom SQL table for your colors FieldtypeSelectExtOption https://modules.processwire.com/modules/fieldtype-select-ext-option/ is a possible solution for your needs, since you can use the hex code as the value here.
  21. If the target page (new parent) doesn't have already children you need to mark (click) it before moving the other page.
  22. I use this 5 lines of code, placed in an access controlled folder under root, to run a cronjob at fixed time. Just set 'cycle' in module settings to 'none' to prevent database backups triggered by LazyCron as well. <?php namespace ProcessWire; $root = dirname(__DIR__); include_once("$root/index.php"); $cdb = $modules->CronjobDatabaseBackup; $cdb->cronBackup(); Thanks for the input. I thought about it. In the end, I'll leave it as it is, and the inclusion of manually created dumps in the cleaning routine remains the standard. When I manually create a dump, I usually move or download it immediately. I rarely (never?) leave it on the live server and I want the files removed automatically. The default name created by ProcessDatabaseBackups is the database name. Just use this as the 'stopword' and use a different name format in the setup of CronjobDatabaseBackup and voila it works exactly as you want it. Furthermore there is also the option to save the files in a user-defined directory. Manually created dumps are then never affected by the CDB's cleaning routine.
  23. This should have been already implemented with the option to set a custom storage path. Unfortunately I recognized a bug while looking in this. This bug is fixed now and I made some additional changements. Please update to v1.2.3. The automated cleanup effects only the custom path and not site/assets/backups/database/ used by ProcessDatabaseBackups. Currently you cannot use ProcessDatabaseBackups to edit backups stored under a custom path. I added functionality to protect files by 'stopword'. Files having this in its names or descriptions will be protected from beeing deleted by the cronjob. Just set the 'stopword' in the module config. @bernhard @horst @Robin S I hope the fix helps and feeds your needs (?)
  24. Example with a multidimensional array. RepeaterMatrix fieldname = 'fieldname' first level: page where the repeater field lives in, indexed by ID second level: per page repeater items indexed by ID third level: field inside repeater indexed by name $rp = $pages->find('fieldname.count>0'); $return = []; foreach ($rp as $p) { $return[$p->id] = []; // RepeaterMatrixPageArray foreach ($p->fieldname as $item) { if ($item->type != 'basic') continue; $return[$p->id][$item->id] = []; // RepeaterMatrixPage foreach ($item->template->fields as $repeaterField) { if ($repeaterField == 'repeater_matrix_type') continue; // we do not need this if ($item->$repeaterField === '') continue; // if you want to ignore empty strings $return[$p->id][$item->id]["$repeaterField"] = $item->$repeaterField; } // remove if empty if (empty($return[$p->id][$item->id])) unset($return[$p->id][$item->id]); } // remove if empty if (empty($return[$p->id])) unset($return[$p->id]); } var_dump($return);
  25. Please check access settings in the related page template and parent page template.
×
×
  • Create New...