Skip to main content

views

Getting a themed views title within a style tpl file

I ran into an issue today where I needed to get a themed views title from within a views row style template file (tpl). I tried using drupal_get_title() and menu_get_item() but the title elements were all blank for these. Next I inspected the $views object looking for the themed title but it was not listed. Finally, I discovered within $views->build_info the title and substitutions variables.


Views menu tab displayed on only certain content types.

I recently ran into an issue where I wanted to use a views page as a tab for nodes of type 'course'. I added the view page like normal, providing my path of: node/%/course-list.

Next, I added my menu item entry as a 'menu tab'.

Perfect, except that the menu tab was displaying on every node when I needed it to only display on one node type.


Drupal Calendar: Use a Drop Down Menu to Change Calendar Dates

We had a Drupal 7 site setup with a default calendar instance that was displaying content of type 'event'. Due to the limited number of events this site would promote, it was decided to change the navigation from the standard 'Next/Previous' to use drop down menus where the user could choose the month/year they wanted to view.

The original look


Drupal Views Slideshow: Prevent widowed items on slides.

We have a site that is running the views slideshow module to display advertisement images. Recently a client asked us to prevent these advertisements from displaying only one item on the screen. In order to do this I began dissecting the views slideshow module code and I came across the template_preprocess_views_slideshow_cycle_main_frame() function. This function takes care of rendering the rows.


Setting Dynamic Views Filters With Drupal Using hook_views_query_alter()

Today I had the challenge of generating a view that needed to filter results based on the date/time a node was created. More specifically, I needed to filter bowling stats for a season. Easy, right? The problem I ran into is that the bowling season doesn't begin and end in the same year. So using an argument to only grab nodes created in 2011 didn't work. I needed the view to grab nodes between July, 2010 through July, 2011.