strandoo Posted June 22, 2022 Share Posted June 22, 2022 Hi. Sorry about the confusing title. I suspect this might be a case for the owner selector, but I can't figure it out. I've got Video pages (about 140) where each video can be tagged according to subject (tags are a Page Field displayed with checkboxes). Videos are then added to a Client page, also with a multiple checkbox Page field. A client logs onto his/her page to see a number of videos selected for this client, displayed in a grid with a list of the aforementioned tags in a sidebar. Clicking the tags displays/limits the videos via Ajax. All pretty simple (getting all tags, selecting vids by tag page field). Now the client wants to limit the tag list based on the clients' available videos (so they only see the categories of 'their' videos). I'm not sure how to select just the tags that are included in the videos that are included in the client page. It's probably simpler than I think. I suspect I need to get the 'owners' of the PageField for the videos of the client, but I'm not sure how to construct that. Any pointers? Thanks in advance. Oh, and these are fitness videos. Although, I suppose they could be just about anything... Paul Link to comment Share on other sites More sharing options...
Robin S Posted June 22, 2022 Share Posted June 22, 2022 I think you want something like this: // Get all the tags that are used in this client's videos $tags_in_use = new PageArray(); foreach($client->videos as $video) { $tags_in_use->add($video->tags); } // Sort the tags if you like $tags_in_use->sort('title'); // Output the used tags in the sidebar foreach($tags_in_use->sort('title') as $tag) { // ... } 2 Link to comment Share on other sites More sharing options...
strandoo Posted June 23, 2022 Author Share Posted June 23, 2022 @Robin S Ok, that is concise, clear and – now that I see it – much simpler than I thought. As usual, things are always easier with PW. Many, many thanks. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now