Jump to content

a-ok

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by a-ok

  1. I'm searching two different templates in my search results and would like to split these results into two results, one per template. I'm guessing I might have to loop through them and remove the articles with X template then store them and add them after but I wondered if there was a better way? <?php $results = ''; if ($q = $sanitizer->selectorValue($input->get->q)) : ?> <?php $input->whitelist('q', $q); $matches = $pages->find('title~=' . $q . ', template=speech-archive-detail|training-detail, sort=template'); $count = count($matches); ?> <?php if ($count) : ?> <?php foreach ($matches as $result) : ?> <?php endforeach; ?> <?php endif; ?> <?php endif; ?>
  2. @adrian Is mp4 supported by all modern browsers? Is that why you're leading with that? I've had a google... seems to be... https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
  3. Ah yes good point! I wonder if we could use the file description field... would be a bit hacky for sure. It would probably be many at a time (video wise) so yes I would look to store this on upload so it's stored in the DB. Hmmm. Your idea of generating a poster from the video is smart (presumably this poster is the same height/width as the video itself?) and could definitely be the answer.
  4. I wonder if we could use FFmpeg to determine the height/width? I'm thinking I could write a hook to do this on a File fieldtype instead and return the values somehow.
  5. Thanks but it doesn't allow multiple file formats or allow me to return height/width.
  6. Just a quick question. I'm guessing there's no way to get a file dimension (height/width) (specifically video files (.mp4/.webm)) from a file upload field like we can for images? I realise that height/width won't be retrievable for ALL file types but what about video files? Does anyone know if the dimensions are stored in the meta data of the file like they are for images?
  7. Can you recommend any specific companies?
  8. As the subject suggests (apologies if this thread already exists... if so do point me in the right place!) I'm a bit overwhelmed with all the hosting platforms that exist these days. I work with a lot of clients and have previously used MediaTemple and TSOHost as it's managed cloud hosting and seems the quickest and easiest way to get things going but I want to venture out and have been looking at things like DigitalOcean, Linode and Amazon LightSail but these are all CLI setups and unsure if it'll be a steep learning curve. As I use PW for every CMS-driven site I only need a standard LAMP setup but wondered what other people use for site hosting and what you would recommend? Thanks all!
  9. Thanks, abdus. Looks like this module may be just the trick. My favourite part?
  10. Forgive me if this question already exists somewhere... but struggling with the following. I have a parent > child page system of events (Events > Event 1), and for each event (page) there is a repeater of dates (to allow multiple dates). On each event there is also a PageReference field for the client to select 'tags'. This is also a parent > child structure (Tags > Music). I am wanting to create a tag filter for the front end so ideally I'd like to return all the tags, in use by events (as these tags are also used by other sections) that's dates haven't passed yet. I current have the following which is returning all the event pages still in date... $events = $pages->find("template=events-detail, events_detail_dates.events_detail_dates_start_date>today"); I think thought I would have to loop through these pages, grab the tags, then build each result into an array and use remove any duplicates (would $a->unqiue work?) so I end up with a clean list. I'm just not 100% sure that's the best way to proceed... can anyone confirm? Thanks!
  11. I thought it should've worked too as long as it's inside a selector... but alas it didn't. Using time() does the trick, though. And yep strtotime("now") works too so I'll use that instead. Maybe it's a bug? Hard to see how it could be as it's within a filter selector.
  12. Thanks. It does exist (http://cheatsheet.processwire.com/pagearray-wirearray/sorting-and-filtering/a-filter-selector/) in this context (pageField returns an array) BUT it looks like it doesn't support 'today' so looks like I have to use time(); instead.
  13. I have a pageReference field which the client is then picking/choosing events. In case the client forgets to take off past events I wanted to ensure that events whose start date is greater than today would be filtered out. Any thoughts? I thought the below would work but it's returning nothing. If I remove the filter it returns all the pages chosen by the pageReference field... so it's something to do with my filter. $events = $page->our_picks_events->filter("events_detail_dates_start_date>today")->sort("events_detail_dates_start_date, name");
  14. Okay! Cool! I just wanted to make sure there wasn't a better way. Thanks!
  15. Hi folks, I have a list of people as pages, with the titles, for example, Joe Bloggs, Adam Whyte, Paul Simants). I don't want to have three fields (one for title, one for first name and one for second) to be able to sort by last name... it seems a bit overkill. I reckon I could explode the string and use the last word to sort by (won't work in all cases but could do... or at least everything from first word onwards) but I have two questions... 1. Do you think it's possible to use this exploded result in the selector as a sort option? 2. Is there a way to hook into the sort order for these pages in the backend (Template > Family > Sort settings for children) by using the same exploded result? Rather than what's predefined in the dropdown (the fields).
  16. Thanks for the help. I did try this but it's returned as 1 January 1970. 'events_detail_dates' is the repeater and 'events_detail_dates_start_date' is the date field. $wire->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function($event) { if ($event->object->hasField == 'events_detail_dates') { $event->return = date('D. j F Y', $event->events_detail_dates_start_date); } });
  17. This still isn't possible, right? Within the standard Datetime field? We need to use a separate module?
  18. Is it possible to format a date in when using a date field as the 'Repeater item label'? {events_detail_dates_start_date} obviously returns the timestamp but we can't input PHP here in so I'm guessing not... but any thoughts?
  19. Going to look at this today! Will report back and thank you for your help.
  20. Thanks for testing, abdus. It turns out my line if ($event->object->name == 'home_whatson_article') { needed to be your line if ($event->object->hasField == 'home_whatson_article') {
  21. It has to do with the PageField being inside a repeater... it works fine outside it.
×
×
  • Create New...