Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. @alxndre, I just stumbled upon this module and remembered your post - perhaps it is useful to you? https://modules.processwire.com/modules/process-page-list-multiple-sorting/
  2. That's certainly doable within a template but not simple. You'd have to parse the URL to extract the video ID, convert it to lowercase, add the "video-" prefix and then match it against the image field. I've used the module within a Repeater several times and personally I prefer having a dedicated image field within the Repeater so I can see the thumbnail right alongside the URL. So much easier to identify the thumbnail that way, both visually within Page Edit and in the template file.
  3. This isn't quite the same thing. What @ngrmm wants is unique categories (stored within a Page Reference field on each 'xy' page). Also, it is never necessary to do $pages->find($selector)->unique() because a PageArray is automatically unique.
  4. Maybe I'm missing something, but I don't understand how this can work. If video URLs are entered within a Repeater field then presumably there are multiple videos on the page. So how is the connection between video URL and video thumbnail going to work, given that the sort order within the Repeater and Images field can both be changed independently by the user?
  5. I didn't intend any insult - it's just that I've found from conversations with clients and colleagues that people differ in how much they notice design details. I've had conversations with clients where they literally cannot see the difference between typeface A and typeface B, or colour A and colour B. To them, it's just "a font" or "green", and no amount of discussion changes that. For people in our line of work perhaps it depends on what our background or "first love" is: a person who comes to development via design probably sees things differently to someone who comes to design via development. I don't think that at all. But I do think that there is some significance to crossing from free module to commercial module. There's a greater responsibility to ensure that the product is reasonably mature, tested, and fit for purpose. It's only natural that consumers will have higher expectations if they are buying a product as opposed to receiving it for free. Please don't take it that I'm bitterly disappointed in VPS or anything like that because I'm not. It's an awesome product, but one that I feel needs a bit more work in order to be production-ready. My only intention here was to give some constructive feedback.
  6. // Initialise artist name variable $artist = ''; // Find "work" pages that have this exhibition selected in their "work_exhibition" field // and sort them according to the title (i.e. name) of the artist // Iterate over those works... foreach($pages->find("template=work, work_exhibition=$page, sort=work_artist.title") as $work) { // If the name of this work's artist is different to $artist if($work->work_artist->title !== $artist) { // Then store the artist's name in $artist $artist = $work->work_artist->title; // And output a heading echo "<h3>$artist</h3>"; } // Output the title of the work echo "<p>$work->title</p>"; }
  7. In that case: $artist = ''; foreach($pages->find("template=work, work_exhibition=$page, sort=work_artist.title") as $work) { if($work->work_artist->title !== $artist) { $artist = $work->work_artist->title; echo "<h3>$artist</h3>"; } echo "<p>$work->title</p>"; }
  8. @kongondo, thanks for the responses. Note how in the modal the Edit view replaces the Add Pages view, with no option to return to Add Pages. Here's what I see when doing the same thing. Chrome, Windows. This is on a clean PW 3.0.80 installation with VPS v0.0.4 and no other modules. I notice your screen capture shows admin theme Reno. You checked with the default admin theme? I would have thought that nearly all new site developments use PW3. I know I have never contemplated building a new site with the old <= v2.7. And most buyers would be using VPS for new projects rather than retrofitting it into old projects that they are not willing to upgrade, wouldn't they? As for the visual details: some people are passionate about this stuff, some people can't see what the fuss is about ("It still works, doesn't it?"). To me, VPS sort of looks and feels like a product that is at a draft stage. I don't mean disrespect by this and I know a lot of work has gone into it, I just was expecting a bit more polish seeing as VPS is presented as a professional commercial product.
  9. I read your post a few times but wasn't able to grasp exactly how you have this set up. In case it helps, here is how I would tend to approach this... Work template: has Page Reference field for Artist Exhibition template: has Page Reference field for Works Then in your Exhibition template file: $artist = ''; foreach($page->works->sort('artist') as $work) { if($work->artist->title !== $artist) { $artist = $work->artist->title; echo "<h3>$artist</h3>"; } echo "<p>$work->title</p>"; }
  10. Thanks for the report @adrian. I have fixed this in v0.0.2. Now the Save + Add New button is not added when editing inside a modal, as I don't think it's desirable in those circumstances (another case of this is when editing a field's template context from the template editor).
  11. Does anyone know if there is a way to install a module via the "Add Module From URL" feature if the module is in a private repository? It's a GitLab repository in this case. When I try to do this it fails with: The URL is correct, but no doubt needs authentication to be accessed. Is there a way to supply username/password to allow the download?
  12. You can install the core LanguageSupport module and then "translate" the string for the Default language:
  13. The admin page always has the ID of 2 (as far as I know). So you can get the httpUrl with: $pages(2)->httpUrl()
  14. Another option for adding elements at the end of <head>: $wire->addHookAfter('AdminTheme::getExtraMarkup', function(HookEvent $event) { $parts = $event->return; $parts['head'] .= "<script src='/path/to/script.js'></script>"; $event->return = $parts; });
  15. I'll try that, thanks. Looking at that chunk of code, it's not about setting items to an uninitialised array with $paths[] = $path (which is okay) but if $iter is empty then $paths does not exist.
  16. Yeah, it's a Java app so it's not picky about OS or version.
  17. That's the organisation pricing. You're an individual customer so it's $89. And you don't need to pay anything beyond that. See the license details. The ongoing "subscription" is if you want to receive updates (sort of like the system with Ryan's Pro modules), but the reality is that an IDE is a glorified text editor - it's not like they're bringing out must-have new ways to edit text every other month. So you'll be fine with the current version for some years to come.
  18. Hi @adrian, What do you think about the idea of adding a filter search to the Captain Hook panel? Much of the time when I use this panel I know the name of the class and method I want to hook and I'm just wanting to check what the arguments are (and it's a handy way to jump to the method in my editor). Not sure how tricky that would be to implement. Even if it just worked on the top level (the file names) it would be cool.
  19. Welcome to the forums @Smoo. The markup is the content, but if you are seeing tags rendered like that then it could be caused by encoded entities. Check to make sure you do not have "HTML Entity Encoder" selected under "Text Formatters" in the field settings.
  20. FieldsetTab is not supported by the core "show if" dependency, but it turns out it is possible to support it in this module. Please update to v0.0.5.
  21. Perhaps some exception or PHP error is occurring. Do you have debug mode on or (even better) Tracy Debugger installed to make sure you see error messages?
  22. Let's do a comparison of how you would do this with the typical delayed output approach vs Markup Regions. When it comes to the Markup Regions example I'll do it a little differently than you've proposed it, with a dedicated <region> for scripts instead of appending to <head>. Delayed output _init.php $scripts = ''; _main.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <?= scripts ?> </head> //... template-which-needs-js.php if(strpos($page->name, 'special') === 0) { $scripts .= "<script src='{$config->urls->templates}assets/js/my-script_2.js'</script>"; } else { $scripts .= "<script src='{$config->urls->templates}assets/js/my-script_1.js'</script>"; } Markup Regions _init.php Nothing needed here because one of the nice things about Markup Regions is that you don't need to initialise a markup variable. _main.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <region id="scripts"></region> </head> //... template-which-needs-js.php <region id="scripts" pw-append> <?php if(strpos($page->name, 'special') === 0): ?> <script src="<?= $config->urls->templates ?>assets/js/my-script_2.js"></script> <?php else: ?> <script src="<?= $config->urls->templates ?>assets/js/my-script_1.js"></script> <?php endif; ?> </region> So comparing a markup region to a variable: Use pw-append where you would have used $some_var .= 'something' Use pw-prepend where you would have used $some_var = 'something' . $some_var Use neither pw-append nor pw-prepend where you would have used $some_var = 'something' But Markup Regions are even more powerful because you can have multiple nested markup regions in _main.php, which is something you cannot do with variables.
  23. Pretty sure that's just a typo, and should read "This does the same as above". You can do anything with Markup Regions that you can do with the typical delayed output approach. Each markup region serves the same purpose as some variable that you would put markup in and output in _main.php, like $sidebar or whatever. There are a few ways. Here is one... _main.php (just showing the main content part - of course there will be <head>, footer, etc in this file too) <region id="main-content"> <region id="top"> <div class="full-width-coloured-bg"> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </div> </region> <div class="container-1400px"> <div class="row"> <div class="col-10"> LEFT SIDE </div> <div class="col-2"> SIDEBAR </div> </div> </div> </region> basic-page.php This file can be empty because _main.php is based on the markup needs of basic-page. But until this bug is fixed you might want to include some dummy region in basic-page.php or else the Markup Regions parser won't be triggered and <region> tags in _main.php will not be removed. home.php <region id="main-content"> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </region> services-page.php <region id="top"> <div class="full-width-coloured-bg"> <div class="container-1400px"> FULL WIDTH STUFF </div> </div> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </region>
  24. Just a heads up regarding a possible fix posted in the GitHub issue: https://github.com/processwire/processwire-issues/issues/411#issuecomment-340139239
×
×
  • Create New...