views 2

Modify Views SQL Query in Drupal, Restrict View to Search Term

Jeremy John's picture

So I wanted to be able to pass a default value to the the Views search filter, to filter by a view by a search term, to display that view in a block.

EDIT: There is an easier way to do this, which renders this whole tutorial useful only for other SQL hijacking. Under Filter, select Node: Body. See screenshot.

I had two options, create a view, create an RSS feed, run it through Yahoo Pipes, and cycle it back through, or modify the views query.

Tutorial: How to Group Fields in Views With a Div or Span Tag

This is a howto for wrapping a div around a few of your view fields (and not others). This is useful, for instance, for being able to group all one's content so that it floats left but does not float around an image.

EDIT: This technique is a good intro to views templates, however, an easier way exists which seems a little hackish, but would work for many use cases. Thanks to Sr. or Sra. Anonymous.