Drupal: How to get views argument into header/footer/empty view

10,637

You want to use a view argument in your view's header, footer or empty text fields.

You would enter this code in the view's basic settings.

  1. Edit your view -- Administer -> Site Building -> Views -> List, then click Edit for the view you want to modify.
  2. Click Defaults or one of the other displays for your view (e.g. Page, Block, etc.).
  3. In the Basic Settings box you will see lines for Header, Footer and Empty text. These probably say "None" next to them, but click the None to expand the input box.
  4. Under the input box, click Input Format to reveal the options, and choose PHP Code.
  5. Paste your code in the box and add some code to do something with the argument.
  6. Click Update to update the Field. Click Save to save the changes to the view.
Share:
10,637
p0larBoy
Author by

p0larBoy

Javascript all day, err day...

Updated on June 05, 2022

Comments

  • p0larBoy
    p0larBoy almost 2 years

    I found this code snippet:
    <?php
    $view = views_get_current_view();
    $arg0 = $view->args[0];
    ?>

    but i don't know where to begin inserting this php code snippet.