Jump to content

gebeer

Members
  • Posts

    1,477
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by gebeer

  1. I would not have expected this since the lib is actively maintained and used by many projects. But in the github issues I saw that the author seems to be working on PHP 8 support. Most things we can do with CSS/JS but if you want to deliver completely different content for mobile devices, doing it on the PHP level is a viable option. Caching is a problem, though and needs some extra attention. Personally I would solve this through img srcset and size attributes. No need for separate code here.
  2. @snck I am currently working on implementing Repeater Matrix support. It is basically working but needs some more thorough testing. ATM the setMatrixItems() method seems to be working well. If you like, you can grab a copy from https://github.com/gebeer/RockMigrations/tree/repeatermatrix and test it out. This is how you create a Repeater Matrix field: // first create the blank field $rm->createField('repeater_matrix_test', 'FieldtypeRepeaterMatrix', ['label' => 'Product Content Blocks', 'tags' => 'products']); /** * Set items (matrixtypes) of a RepeaterMatrix field * * If wipe is set to TRUE it will wipe all existing matrix types before * setting the new ones. Otherwise it will override settings of old types * and add the type to the end of the matrix if it does not exist yet. * * CAUTION: wipe = true will also delete all field data stored in the * repeater matrix fields!! */ $rm->setMatrixItems('your_matrix_field', [ 'foo' => [ // matrixtype name 'label' => 'foo label', // matrixtype label 'fields' => [ // matrixtype fields 'field1' => [ 'label' => 'foolabel', // matrixtype field options 'columnWidth' => 50, // matrixtype field options ], 'field2' => [ 'label' => 'foolabel', // matrixtype field options 'columnWidth' => 50, // matrixtype field options ], ], ], 'bar' => [ // matrixtype name 'label' => 'bar label', // matrixtype label 'fields' => [ // matrixtype fields 'field1' => [ 'label' => 'foolabel', // matrixtype field options 'columnWidth' => 50, // matrixtype field options ], 'field2' => [ 'label' => 'foolabel', // matrixtype field options 'columnWidth' => 50, // matrixtype field options ], ], ], ], true); Still need to test the other methods for removing/adding items etc. But this one should work. At least it was working in my tests. When testing is completed I will make a PR so @bernhard can implement.
  3. Hi all, we are moving a site from TYPO3 to PW. The old site has all URLs end in .html. Is there a simple way to achieve this in PW without breaking things like urlSegments, pagination etc. ? It might be doable with a hook to Page::path but I think that will break urlSegments. Maybe instead of trying to achieve that goal it might be better to implement redirects. Has anyone done this before? Would be great to hear your opinions/experiences.
  4. I wouldn't rely on this regex for mobile detection. There's a great library for that: https://github.com/serbanghita/Mobile-Detect You can simply copy the MobileDetect.php to site/templates/inc/MobileDetect.php. (If you prefer, you could install it via composer) And then include it in _init.php and use it like include_once('./inc/MobileDetect.php'); function isMobileDevice() { $detect = new \Detection\MobileDetect; return $detect->isMobile(); }
  5. Sorry, my fault. Try $item->colwidth->value
  6. To me this looks like a redirect issue. Thing is, that $_FILES gets cleared when POST requests are redirected. You can check for redirects in your browser dev tool's network tab when you submit the form. If you use the exact same form for both submissions (company and employee), you need to check what is different when you submit the form. Is the form action URL for both exactly the same? Do you have any code in place that redirects the form submission to a different URL when using it for employee?
  7. I'd go with FieldtypeOptions. Let's say your field is called "colwidth" and your options are: 1=1 2=2 3=3 Then you could do something like <?php $w1 = $page->colwidth; $w2 = 4 - $w1; ?> <div uk-grid> <div class='uk-width-<?= $w1 ?>-4@m uk-width-1-1@s'> <figure> <img src='{$page->image->url}' alt=''> </figure> </div> <div class='uk-width-<?= $w2 ?>-4@m uk-width-1-1@s'> $page->body </div> </div>
  8. Yes, you can use https://processwire.com/blog/posts/processwire-3.0.74-adds-new-fieldsetpage-field-type/ exactly for that so you can reuse other fields inside the FieldsetPage fields. Think of repeaters without repeating ?
  9. Love them. But too heavy for me while programming. I like light background music that helps me concentrate https://www.youtube.com/user/StudyMusicProject
  10. Hello and welcome to the forum! your question is related to a 3rd party module https://processwire.com/modules/markup-processwire-photoswipe/ On the module page you can see a link "Support" which links to the dedicated forum thread for that module. You might want to ask your question there. Besides that, the module has last been updated 6 years ago. So it uses an old version of the https://photoswipe.com/ script and might not be compatible with the latest ProcessWire version. In general, 3rd party modules are maintained by their authors and it is up to them whether they update them and offer support. It is up to youwhether you want to use and rely on a module with outdated code. After having a quick look at the module code, there is no easy way of bringing in the page title into the markup through the available render options. Like stated in the module documentation, you would have to extend the MarkupPwpswpGallery class. Alternatively you could edit the module code directly to achieve what you want. For a start have a look at https://github.com/blynx/MarkupProcesswirePhotoswipe/blob/a7c495964262f30eb28e891437665913ea5c5164/MarkupPwpswpGallery.module#L162 following and https://github.com/blynx/MarkupProcesswirePhotoswipe/blob/a7c495964262f30eb28e891437665913ea5c5164/MarkupPwpswpGallery.module#L196 following.
  11. Hello all, there are some older posts about nginx configuration for PW like @LostKobrakai created a gist. We have some sites in production on apache with nginx reverse proxy. One of those is receiving webhooks from snipcart. And in some situations the POST requests from snipcart are redirected through nginx and the POST request body data gets lost in this process. We are receiving those requests in apache with headers like where "HTTP_X_HTTP_METHOD_OVERRIDE": "POST" is sent like this by snipcart ... "REQUEST_METHOD": "GET", "HTTP_X_HTTP_METHOD_OVERRIDE": "POST", "QUERY_STRING": "it=/webhooks/snipcart/&", ... file_get_contents('php://input'); is null in those cases. After doing some research I found it could be related to the location / { try_files $uri $uri/ /index.php?it=$uri&$args; } directive in the nginx vhost.conf. I couldn't find the reason for the nginx redirect since the POST request is going to an existing endpoint /webhooks/snipcart/ (with trailing slash) and making test requests with POSTMAN didn't result in redirects. Has anyone else experienced this behaviour and knows a solution?
  12. I think it is totally ok to instantiate the script multiple times within the foreach.
  13. You have this div inside a foreach. Which means that you get multiple div#container in your HTML which will not validate and might cause problems with JS. You can add unique ids to the id with something like div id="container-<?= $book->id ?>" and see if that helps.
  14. 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.
  15. That sounds like a good way to approach it.
  16. 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!
  17. 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); }
  18. @Gideon So you posted just seconds before me ?
  19. 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;
  20. 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="äöü"'
  21. 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
  22. Then it should have utf8mb4 charset. Is it in the list of charsets when you run the query "SHOW CHARACTER SET;" like described above?
  23. To see the MySQL version, run this query: "SHOW VARIABLES LIKE 'version';"
×
×
  • Create New...