views:

13

answers:

1

I am looking to add separate buttons that will be displayed at the top of the view that I am creating in Drupal.

So far all the fields that I have added appear inside of the table as they should. The only thing that shows outside of the table is the search filter above (as it should).

I would like to add 3 buttons(links) in a row that are positioned above the table and below the search area.

Is there any way to do this in Views? If so could someone describe the process? Thanks!

A: 

The most straightforward way to do this is through the theme layer. Edit the view, and go into the Header option under Basic settings. There, you can put in your custom HTML for the buttons.

However, as you might've noticed, this places the header above the exposed filters, whereas you want the header below them. To do this, go into the Theme information option under Basic settings, and find the Display output section.

There, you'll see a list of file name hints. Create a file within your theme using one of those filename hints. Then, click on Display output: you'll receive the default code you'll need to put within your newly created template file.

You'll notice in this new template of yours that the $header code block is before the $exposed code block. Just switch the positions and save your template. Back on the view configuration page, click on Rescan template files, save your view, and the header you've added will now be below the exposed filters.

Mark Trapp
Thanks for the Answer Mark!This was a clear, concise and has really helped put Views into perspective (no paronomasia intended). I carried out the task as the instructions indicated. I just have one more question. Its a little bit ignorant, although im new so... Here goes; Where do I put the new file? here /themes/sky/templates/overides ??
David Hughes
You want to put the new file in the root directory of your theme. So, if if your theme is `/themes/sky`, the file would be `/themes/sky/templatatename.tpl.php`. One thing to note is that when you update Drupal, the `/themes/` folder could get overwritten, so most people keep that folder pristine and put non-core stuff in `/sites/all/themes` (i.e. your theme would be in `sites/all/themes/sky`). The `sites` folder is, for the most part, untouched during core updates.
Mark Trapp

related questions