开发者

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

开发者 https://www.devze.com 2023-01-02 21:55 出处:网络
I found this code snippet: <?php $view = views_get_current_view(); $arg0 = $view->args[0]; ?> but i don\'t know where to b开发者_运维问答egin inserting this php code snippet.You want to use

I found this code snippet:

<?php

$view = views_get_current_view();

$arg0 = $view->args[0];

?>

but i don't know where to b开发者_运维问答egin inserting this php code snippet.


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消