I looked through views and didn't find documentation or examples on this. With the og_views module, does a view need to be created for each group separately? Or, is there some way to have one view that shows different content based on the group being viewed at that moment?

I'm attempting to use a flexinode for the groups, and want to have content output using a few differnt views that filter by the node type, taxonomy, and og. If I need to I can create these views separately for each group, but I supsect there is a way to just create one view and somehow have it be aware which group is being viewed at the moment.

Comments

jasonwhat’s picture

I'm still having problems getting flexinode to work, but thanks to some great support on this thread I'm getting closer to what I'm after, http://drupal.org/node/62659.

I figured out how to pass an argument to a view when the view is embedded within a page.

$view_args = array('557');
$view = views_get_view("groupnews");
$output = views_build_view('embed', $view, $view_args, $view->use_pager, $view->nodes_per_page);
return $output;

In this case I have a view called "groupnews" with one argument waiting to be filled which is Og_nid. I can obviously use this code to manually do this, however, I'm thinking that it might work to use this on the group homepage and pull the argument from the group hompage's url using the drupal arg function. I can then use this code to have complete flexibility in creating views that are embedded in group homepages. In my case I will probably use tabs below the group mission to display latest news, press releases, etc. The nice thing about this approach is I can create one vocabulary that all groups post into, and use the views to lay them out on each group homepage.

The reason I'm writing this out so extensively is because I'm wondering if there is some other way to do this within OG, og_views, or the og templating system that I'm missing, or if this seems like a good approach to more flexible layouts of group homepages.

moshe weitzman’s picture

if you look at the group by content type view, you see what you describe just wioth fieldsets instead of blocks or whatever you want. the presentation of group home page is handled by theme_og_view and another internal theme function. use them as needed.

group home pages will eventually be more obiously Views integrated soonish.

jasonwhat’s picture

Right, I know this is possible by selecting that option on the settings page, but are there code samples that make this more flexible that could be used now?

As far as using views, is that the best approach since og is headed that way anyways? Also, what is the timeframe for greater views implementation?

moshe weitzman’s picture

sorry, there are no code examples specific to this. you gotta understand theme function overrides in general. see drupal.org/phptemplate ... no timetable for better views integration. i won't even guess much. i'd say this year is a safe bet.

moshe weitzman’s picture

Component: OG Views » og.module
Status: Active » Fixed

og_views is pretty capable now. you want an argument for this.

sodani’s picture

where can one find this og_views module. I can't seem to find it anywhere...

I see the og_views.inc file in the og package, but if that's what I'm supposed to use, I have no idea what to do with it. I'd like to do what jasonwhat is doing. =)

sodani’s picture

Status: Fixed » Active

opening

moshe weitzman’s picture

Status: Active » Closed (fixed)

no addional module anymore. if you have viws.module and views_ui then you canstart using this. use the og argument in your views. sorry, can't give views classes here.

jasonwhat’s picture

It's a fair question. It is hard to keep up with the movement of modules.

discursives’s picture

I am trying to do this now...it seems like it is going okay, but I have not yet gotten into the theme og views function yet. Getting there.

Any help appreciated.