4

My setup is really simple. I have a taxonomy view that takes two contextual filters:

  • Has taxonomy term ID (with depth)
  • Has taxonomy term ID depth modifier

Due to a new request I need to be able to change the footer of the view based on the contextual filter. Since the contextual filter isn't inside the [fields] array of the view how can I access its value in my template file?

3

You can achieve this functionality in views itself

  • In footer add a global text area
  • Select PHP code in the text format select box
  • Enter the following code

    $view = views_get_current_view();
    /* $view->args will contain all the argument values in the order */
    

However make sure to include php opening and closing tags and read this one if you have multiple views in same page.

  • Thanks. With $view->args I can get the tid of the term. The link you provided seems very useful since my view is actually an attachment to another view. That probably saved me a few hours. Cheers – Perisdr Oct 9 '12 at 16:51

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.