p0larBoy
p0larBoy

Reputation: 1310

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

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.

Upvotes: 3

Views: 10735

Answers (1)

sbc
sbc

Reputation: 136

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.

Upvotes: 6

Related Questions