Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2007 at 16:14 UTC
Updated:
30 Mar 2007 at 18:01 UTC
I have created a page view to show data depending on which taxonomy term id is submitted in the url. This works. While %1 in title tells me what taxonomy term requested, I can't seem to get any variables to show up in the page header field. The page header does display text and php code though when I used several variables I thought would be available, everything was empty.
I would like to create a PHP snippet that returns a different header for the page based on what term is submitted. So I want to test what term it is so I can make the choice. Is this possible in the header field or do I need to put it in my phptemplate?
Comments
Comment #1
merlinofchaos commentedThere are no special variables available in the header. It's surprisingly hard to get variables to it.
You can use global $current_view; to get the $view, and it's full of all kinds of interesting data that you'll need to look through to find what you want.
Comment #2
srcerer commentedI see a lot of data and I could parse the url to figure out the term id and display the appropriate data. But $current_field is empty for taxonomy terms that have nothing assigned yet. So it may not make sense to rely on putting standard, overview text in the Header field. There are other places for it but I thought this would be easy...
Thanks for the quick response!
Comment #3
merlinofchaos commentedLook in $current_view->args -- that should give you the raw arguments that came in. You have to know which argument is your tid (which is probably the only argument) -- then you can load the information from the database.
Yes, stuff like this ought to be easier. Unfortunately, for every thing Views does to make your life easier, there' sosmething else it doesn't do that it seems like it could. This is one of them. =)
Comment #4
(not verified) commented