Views

User login

Drupal 7: Views pager not showing!

A weird issues came up after upgrading from Views version 7.x-3.7 to 7.x-3.8. The pager was missing from all views.
After making sure that there are enough results to bring up a pager, and that the pager ID was unique for each view that shows up in the same page, we noticed the one thing that all views had in common: They all used Global: PHP fields.

Remove duplicate entries from views results... the hard way.

In some cases it is seems impossible to get rid of the duplicate entries that views return in the output.
Not an elegant way, but this small module would do the trick...

So let's create a module the usual way, and put the following code in the .module file.
This one is called remove_duplicates.


<?php
function <MY_MODULE>_views_pre_render(&$view)
{
 
$used_nids = array();

          foreach (
$view->result as $row)
      {
        if (!
in_array($row->nid, $used_nids))
        {
         
$new_view_result[] = $row;
         
$used_nids[] = $row->nid;
        }
?>

Translate <Any> in Views Exposed Filter

While trying to translate the <Any> string in Views, locale returned the error "unsupported HTML".

A quick workaround is to switch from <Any> to -Any-; There is an option available under the Views Tools tab just for that.

The string "-Any-" is translatable, so from this point on it is easy to search for the string "-Any-" in locale search. If it is not found, you would probably need to check that you typed Any in the search form (case sensitive!).

Once found, it is easy to enter the required translation.

Draw circle overlay in all points in gmap from Radius in a CCK field | Dynamic gmap Macro in Views

Lately I needed to add a circle in every marker in a gmap provided by Views.

So in order to achieve this, I filled in the Macro textarea of the Style:Gmap settings of the View with the following code. But first, I added the field that contains the Radius value and excluded it from Display, to make the value available in the view result set. This value was in miles, so I made the conversion from km as well.

Subscribe to Views