Jump to content

Using page field results to limit displayed options depending on page results (! probably an owner selector question?!)


strandoo
 Share

Recommended Posts

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

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) {
	// ...
}

 

  • Like 2
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...