Services

  • Drupal CMS Websites
  • Drupal and PHP Developer
  • Custom solutions in PHP/MySQL/jQuery

Welcome

Welcome, I am a Web Developer based in Estepona, Costa del Sol, Spain originally from the UK. I studied Computer Science & eBusiness at Loughborough University. I specialise in Content Management System websites

Drupal Views2 - Display all values if no results with exposed filter

I had an issue where I had a google map showing the locations of results, and a filter which helped you zoom in on locations. Basically you typed a location and the map showed the location of the results as well as some listings. However, if there were no results, instead of showing an empty page, I wanted the google map to appear with all results and an error message. What I did was set up an "Empty text" value which called a views function "views_embed_view()", I then created a block within that view but without the exposed filter (actually removing that filter all together).
In the Empty text value of the main view display I put...


<?php
echo views_embed_view("NAME OF VIEW","NAME OF DISPLAY",array("ARRAY OF VALUES IF I WANT TO PASS ANY","JUST REMOVE THIS PART IF YOU DO NOT WANT TO PASS ANYTHING"));
?>

Comments

Display Format

Be sure to change the Display format from HTML to PHP Code otherwise it won't work!

Post new comment

The content of this field is kept private and will not be shown publicly.
1 + 10 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.