Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.2
Component:
Views Data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2008 at 17:30 UTC
Updated:
24 Nov 2016 at 00:44 UTC
Jump to comment: Most recent
Comments
Comment #1
merlinofchaos commentedBecause the header uses the default Drupal PHP interpreter, Views variables aren't available there like they are in the arg php code. You can get them by doing
Comment #2
NoRandom commentedIt worked, thanks a lot for the information.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
pcave commentedHow is this accomplished in drupal 6 with views 2?
Comment #5
pcave commentedBump
Comment #6
a_c_m commentedbump/subscribe
Comment #7
clivesj commentedIf have dumped the view object to see where to grab the arguments, but it seems like the arguments-value is not populated:
I think $current_view->arg[n] should lead to the arguments. If so, this might be a bug and we should open a seperate issue.
I will investigate further and report here if I find anything.
Anyone?
btw: For the time being I will grab the arguments from the URL using drupal arg() function.
Comment #8
clivesj commentedThis will work:
Comment #9
OneTwoTait commentedWorks really well. :)
But, how do we capitalize the first letter of the results?
Comment #10
alienzed commentedShould it be possible to do the following in a view header?
//retrieve current view and set items per page
$view = views_get_current_view();
$view->set_display('default');
$view->display_handler->set_option('items_per_page', 10);
I know that kind of thing works when embedding a view, but it doesn't seem to have any effect.
If that isn't possible, how could I allow a user to choose the items per page without using a different display or embedding the view into another page?
I COULD embed the view but then paths and arguments become a lot more complicated to use properly.
Comment #11
mohammed j. razem@taite11
Comment #12
dawehnermh i think $view should be editable see
Comment #13
OneTwoTait commentedI just tried using that instead and it didn't output anything.
Comment #14
weber01 commentedWhere do you type the php code? I cannot type php into the header, it is formated html
Thanks
Comment #15
Anonymous (not verified) commentedweber01 - Have you checked that the PHP filter module is enabled and you have the necessary permissions ?
Comment #16
Marko B commented#8 works great in d6, saved my day :-)
Comment #17
zkrebs commented#8 worked, but for PHP noobs here's a snippet on how to add html to the result - I am using this to show the letter we're browsing by in a view, which is a views attachment
Comment #18
JRF commentedIn the header of a view, is it possible to get the fields from an entity reference passed as an argument ? And if so, does someone know what php code should I write ?
In my case, the argument (or contextual filter) of the view is a taxonomy term. So I would like to get the description (or body) field of this taxonomy term in the views header.
Comment #19
manmohandream commented#8 worked, Worked for me.
Thanks clivesj
Comment #20
webt commentedTry
<?php print_r ($view->args); ?>