if this module is doing what i think it's doing, i'm very thankful!
in my theme, i've overridden theme_views_view so that whenever a node passes through that function, it gets listed in a global array with its nid as the index. the value is an array of the view's name and type and the node's position in the views result. then when the node is rendered, i check the value in that global array and make some minor theme decisions based on it.
for example, the latest blog post gets a bigger image than the 2nd and 3rd latest blog posts. or a 'person' node which is displayed as a block as the "staff contact" for the activity node in full view, it doesn't show the person's mugshot and postal address.
i never thought this kind of functionality should live in my theme, but i didn't have any ideas of how to abstract it without hacking into various modules.
i know the module is brand new, but can someone give a simple example of where you'd call the context functions?
Comments
Comment #1
Anonymous (not verified) commentedI'm replacing my very amateur-style use of global variables with this very slick module, and I'm happy with the results so far. I'd still like to know a little more about how others are using it, but in the meantime, I thank you for this module!
Comment #2
yhahn commentedWhat you're doing sounds similar to how we (developmentseed) use this module -- you can use context_set in the main page callback (I currently use it in places like nodeapi or form_alter) and then context_get in blocks and in your theme to react to the page context appropriately.
Just added a bleeding-edge version of context_ui today -- you may want to give this a test drive (back up your database, don't use it on a live site, etc.). Among many other things, it provides a context_devel block that will show you what contexts have been set on any given page.
Context_ui is a good demonstration of just one use case for context -- you can define "sections" on your site to be composed of different content types and views, and then associate menus + blocks with this section. It's proving to be a simple and effective alternative to using a url_alias + block visibility + theme hack scheme for setting up an information architecture on your Drupal site.
Comment #3
doc2@drupalfr.org commentedsub
Comment #4
jmiccolis commentedThere is a good write up here http://www.developmentseed.org/blog/2008/jun/13/wri-org-redesign-launche... which may help with overview of how context and context_ui work.
Additionally, the spaces module http://drupal.org/project/spaces uses context extensively and would probably be helpful as well.
Comment #5
yhahn commentedWith the new presentations and screencasts available online I think this has been reasonably addressed (we could always get better).