Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
8 Dec 2008 at 15:17 UTC
Updated:
11 Jul 2009 at 04:47 UTC
How can I access the view arguments via PHP in the view header field in views 2 with Drupal 6?
Thanks!
Comments
Comment #1
gildedgod commented1. Add into index.php before "require_once './includes/bootstrap.inc';" your own variable:
2. View -> Arguments -> Validator options -> Validator: PHP Code
3. View -> Arguments -> Validator options -> PHP argument code:
without "< ? php" and "? >"
4. View -> Header -> Input format: PHP Code
5. View -> Header -> Value:
There may be more accurate ways, but idea is the same)
Comment #2
merlinofchaos commentedOr in the PHP in your header just use
$view = views_get_current_view()and check $view->argsComment #3
gildedgod commentedUnfortunately this method didn't worked for me using views2 as CCK-field through Viewfield.
Comment #4
gildedgod commentedAnd of course modifying core scripts for adding your variables is a bad idea =)
- this is just an example, for production sites you must find another way to add global variables :)
Comment #6
entrigan commentedFor future reference, Merlins method in #2 does work, even with ViewReference module