Jump to content

gebeer

Members
  • Posts

    1,514
  • Joined

  • Last visited

  • Days Won

    45

Everything posted by gebeer

  1. Frontend forms in general would be a good topic. There's so much to find scattered around the forum but still people seem to struggle with it, especially when it comes to frontend file uploads with WireUpload.
  2. +1
  3. That sounds like a good way to approach it.
  4. Sounds great. There are some PW video tutorials out there. But nothing structured or consistent like you are planning to do. Do you mean that others can contribute videos as well? You could use a platform like https://www.codecademy.com/ to publish your courses. Will propably reach a broader audience than a custom made solution. concept of "everything is a page" structuring content working with templates/fields in the admin different output strategies: delayed, MarkupRegions etc PW as headless CMS with https://processwire.com/modules/app-api/ or https://processwire.com/modules/process-graph-ql/ I wouldn't concentrate too much on that because there are tons of tutorials out there already and PW is flexible enough to let devs implement frontend stuff in so many ways. But the basics of where you can place your source files, and how to include assets in template files might be helpful. Go for it and good luck!
  5. Looking at the RepeaterMatrixPage render() method for v0.0.8, you can pass in a file path that will be used for rendering. In the DocBlock for that method it says: "* @param string $file Optional render file, if providing a field name too". But looking at the code, it actually does not require to pass a field name in order to pick up the $file param. So inside your foreach you can implement some logic based on user role and page to pass in a custom render file /** @var RepeaterMatrixPage $item */ foreach($page->items as $item) { $renderFile = ($item->getForPageRoot()->foo == 'bar' && $user->hasRole('baz')) ? '/path/to/custom/renderfile.php' : ''; echo $item->render('', $renderFile); }
  6. @Gideon So you posted just seconds before me ?
  7. For the select dropdown you can use a Page Reference field (e.g. named "content_pieces") with Input field type AsmSelect. This will give you a sortable list of pages: As for grouping the pages that hold the pieces of content, you have multiple different options to go about. Here just 2 examples: put them under one parent: in content_pieces field settings, under setting "Selectable pages" choose that parent give all pages a checkbox field, named e.g. "content_piece", under setting "Selectable pages" choose "Selector string" and enter (without quotes) "content_piece=1" Now in your template PHP you can loop through and output the desired content. Assuming content is in field named "content": foreach ($page->content_pieces as $p) echo $p->content;
  8. Don't think this is DB related then. Umlauts in sanitized selector value are not breaking the selector in my case $val = $sanitizer->selectorValue("äöü"); db($pages->find("title=$val")); // results in: // ProcessWire\PageArray // count: 0 // items: array (0) // selectors: 'title="äöü"'
  9. You can set the collation per database. See here: https://dev.mysql.com/doc/refman/8.0/en/charset-database.html You can run this query for a database to see current charset and collation: USE db_name; SELECT @@character_set_database, @@collation_database; You can run this query for a database to change charset and collation: ALTER DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
  10. Then it should have utf8mb4 charset. Is it in the list of charsets when you run the query "SHOW CHARACTER SET;" like described above?
  11. To see the MySQL version, run this query: "SHOW VARIABLES LIKE 'version';"
  12. In phpMyAdmin click on the Home icon. Now click on the tab "SQL" and insert "SHOW CHARACTER SET;" into the query editor. Now click GO in the bottom right. This should give you a list of available charsets like
  13. I am assuming the template for those users is named 'member'. What is the setting in template member "URLs" tab, particularly the "Should page URLs end with a slash?" setting. If this is set to Yes (default), you need to append a trailing slash to the redirect URL, e.g. mydomain.com/medlemmar/username/ to avoid unnecessary redirects. if ($sanitizer->pageName($userloggedinname) !== $pagename) { $session->redirect($pages->get('/')->url . "medlemmar/{$userloggedinname}/"); }
  14. What is your MySQL version? utf8mb4 support started with version 5.5. This query will list all available charsets: SHOW CHARACTER SET;
  15. Without seeing the code for your redirection there is not much to suggest.
  16. @kongondoIn my install (PW 3.0.200), Media Manager pages for images and documents get saved under Admin->Media Manager->Media Manager:Audio instead of Media Manager:Image and Media Manager:Document. They have the correct template media-manager-image and media-manager-document, but are under the wrong parent. What could be the reason?
  17. @kongondo Media Manager fields always return a MediaManagerArray, even if Maximum Media Allowed is set to 1. This is not bad at all but it would be great if the logic would follow PageFiles or Page Reference field conventions. There we can choose whether to return an Array or a single object. So for Media Manager fields it would be nice to have that option, too. Or a default behaviour where fields with max allowed 1 return a single MediaManager object because returning an array doesn't really make sense in that context.
  18. Try clearing the cache table in the DB. Just a guess but won't do any harm and maybe it helps.
  19. Thanks for sharing this. Looking at the implementation of parentPrevious inside wire/core/Page.php I thnk your solution is perfectly viable and the parentPrevious property was implemented so we can use it in circumstances like these. At which point in your logic are you using the bypassSaveHook session variable to prevent loops, is it inside a different hook to Pages::save? And since you are inside a Pages::saveReady hook, I think you do not need to set $page->of(false) because output formatting is already turned off at that stage. Also you do not need to do $page->save() because this is happening after the hook was executed and the page is saved with the values that you assigned inside the saveReady hook. So the loop most likely is being caused by the redundant $page->save(). Try removing that line and see if you need the bypassSaveHook session variable at all.
  20. When you tested in the fresh PW install, did you also copy all the code in site/templates, site/ready.php, site/init.php from the affected install to the fresh install? Or in other words, can you rule out with certainty that template or hook code might be responsible, especially hooks? I once stumbled over a similar or at least related problem, where all PW queries in the page tree, that are done via ajax returned an error and pages tree stopped working. Then I discovered that an addHookBefore('ProcessHome::execute', $this, 'rootPage') was responsible. In my hook function 'rootPage', I had to do an if($this->config->ajax) return; This is just what came to my mind when reading about your problem. Did you follow the "Optimize" link and which table is this warning referring to? How many entries are there in the DB table "pages"? I can totally understand your frustration and think we all have been there at some point. But, at least for me, all those situations were resolvable in the end. Even if we cannot charge our clients for the effort we put in resolving those issues, these situations can help us to learn and get better at what we are doing.
  21. Why did you create a new user account to ask the same question like again? This could be considered spam. You should better ask follow up questions in your first thread. Did you read @millipedia's answer? It pretty much explains how you would go about. For rendering your "pagination" links you can use something like this simplified sample code: foreach ($mygallery as $gallery) { echo "<a href='{$mygallery->url}{$gallery->title}'>{$gallery->title}</a>"; }
  22. @horstwould be awesome if you could add a doc block to https://github.com/horst-n/WireMailSmtp/blob/bc2432096704b3ffeab8176d558e211a544f9837/WireMailSmtp.module#L808 so we get some intellisense of what the array actually looks like.
  23. Taken from getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses, So you can check with the 'recipientsFailed' entry of the array if anything went wrong. $result = $mail->getResult(); if(count($result['recipientsSuccess']) { // logic for successful mails } if(count($result['recipientsFailed']) { // logic for failed mails } Or you can use return value of ->send() which returns the count of successfully sent mails or 0 on fail: $numberSentMails = $mail->send(); Log these numbers somewhere and add some logic to your send script that counts how many mails have been sent on the current day, adds them to a mail queue or whatever you need.
  24. I can confirm that not all TinyMCE toolbar options are available in the PW version (e.g. save, formatselect). I couldn't even find out how to add separators in the toolbar through field configuration screen in PW. So your implementation is the way to go if you want those customisations.
  25. Multiple problems with your code. in the last code sample you used InputfieldSelect. Now you are using InputfieldText. The latter will give you a text input and has no method setOptions() you set the options before you define $location $fields->location->$label needs to read $fields->location->label Here is working sample code for a form with location select as only field: // define form /** @var InputfieldForm $form */ $form = $modules->get('InputfieldForm'); // define location first before you can use setOptions() /** @var InputfieldSelect $location */ // you need to use InputfieldSelect here, InputfieldText has no setOptions() method $location = $modules->get('InputfieldSelect'); $location->attr('id+name', 'location'); $location->label = $this->_($fields->location->label); $location->required = 1; $location->attr('required', 'required'); // build options array $optionsArray = $pages->findRaw('template=location', 'title'); // set options to the select field $location->setOptions($optionsArray); // add field to your form $form->add($location); echo $form->render(); // will print out the markup for the whole form I left out the whole fhSanitzer stuff and the hook. Let's go step by step and first make the inputfield work. You need to adjust this to the rest of your code. If you want to have a standalone field, not inside a form you would do something like this: $location = $modules->get('InputfieldSelect'); $location->attr('id+name', 'location'); $location->label = $this->_($fields->location->label); $location->required = 1; $location->attr('required', 'required'); // build options array $optionsArray = $pages->findRaw('template=location', 'title'); // set options to the select field $location->setOptions($optionsArray); // print markup echo $location->render(); This will give you markup like: <select id="location" class="required" name="location" required="required"> <option value="">&nbsp;</option> <option value="1001">Location 1</option> <option value="1002">Location 2</option> <option value="1004">Location 3</option> </select>
×
×
  • Create New...