I am using Views 2 to get information from my Drupal 6 site. After getting the data, I want to use a little PHP to do some calculations that are unavailable through Views + Views calc. What is the best way to go about doing this?
I could alter the "Header" or "Footer" text, set the input format to "PHP Code", and try to access the $view object?
This didn't work for me:
<?php
global $view;
print_r($view);
?>
Any other ideas of what to do? What if I wanted to make an entire module that drew off existing Views instead of pulling info out of the db itself?
There is a whole API for views , you may find that for your needs you can use a custom template and do the maths in that. If you are only using the calculations for output then this should be ok, even from a purists point of view.
If you need to do more than a little display logic, I think hook_views_pre_render() is the right hook for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.