I created a template for my view (views-view-fields-xxx.tpl.php). On my view page I use the 'Views Data Export Module' to export filtered views in XLS format.

I cannot figure out how to display the button on the top of the page. I tried printing it out in my template file using :

<?php print $view->feed_icon ?>

but then it prints out the button on every field view. Is there a way to print this field only once? Or another way to move the "feed-icon" to the top of my page?


Solution from: https://www.drupal.org/node/2117433#comment-9422881

  1. Copy the views-view.tpl.php file from views into your theme (or its templates directory if it has one). Note that you can rename the file in certain ways to make it specific to an individual view or display. The "Theme: Information" section of the views UI will give you more information. Also see the blog post for more information on that.
  2. Clear the cache so the site starts using your new template file instead of the default views one. The "Theme: Information" part of the views UI should now indicate that your file is being used.
  3. In your theme's version of the template file move the feed icon section wherever you want it. Potentially you would put it under the exposed filters or something. Currently the the feed icon part of the template looks like this (move this whole section):

<?php if ($feed_icon): ?> <div class="feed-icon"> <?php print $feed_icon; ?> </div> <?php endif; ?>

| improve this answer | |
  • Thanks @Jhilke. I've got one question. Why does it work in my 'views-view.tpl.php' template, but not in my 'views-view-fields--xxx.tpl.php' template? – jae.phoenix May 5 '15 at 5:43
  • template files are bit tricky sometimes. you just need to try with different combinations... there is a documentation about how to use it, in drupal.org I guess... – user12947 May 6 '15 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.