Hi,

Do we have a simple and non-frustrating way to know if the view is empty? I have read questions about it, people as me, who can't find it.

Could you please provide us a code with a sample view name to do it?

Thank you.

Comments

hungdo’s picture

Hi hbu.
Ex, i create a view with "tutorial" name. So, you can add views-view--tutorial.tpl.php into your folder theme.
Edit that file and add

 <?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?> 
merlinofchaos’s picture

Status: Active » Fixed

That answer looks good enough to mark it fixed; if more information is needed, please return to 'active' with the request.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.