I have a taxonomy view with table list and I insert my code into a global php field and use enable click sort: sort numerically, but when I click the label to sort numerically I always get the error below.

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /stocks/views/ajax
StatusText: OK
Fatal error:  Function name must be a string in C:\xampp\htdocs\stocks\sites\all\modules\views_php\plugins\views\views_php_handler_field.inc on line 185

Whats causing this and is there a way to fix it? Im trying to have the field sort by highest number to lowest.

This is the code I am using in the php field.

$currentMonth = date('n');
    $currentMonth = $currentMonth - 1;
    $prevcurrentMonth = date('n');
    $prevcurrentMonth = $prevcurrentMonth - 2;
    $currentDay = date('j');
    $lastDay = $currentDay - 6;
    $currentYear = date('Y');

    $file = file_get_contents("http://ichart.finance.yahoo.com/table.csv?s=$row->name&a=$prevcurrentMonth&b=$lastDay&c=$currentYear&d=$currentMonth&e=$currentDay&f=$currentYear&g=d&ignore=.csv");

    $stockcontent = str_replace('Date,Open,High,Low,Close,Volume,Adj Close', '',  $file);
    $stockcontent = trim($stockcontent);

    $stockcontentex = str_getcsv($stockcontent, "\n");

    $stockex = explode(',',$stockcontentex[0]);

    print $stockex[2];

1 Answer 1


Review this post

You will find there is a value box and a output box.

Your code above suggest you are doing the display from the value box and that won't work.

move most of your code to the value box and then end with:

value = $stockex[2];

then paste

<?php print $value ?>

in the output box.

Good Luck!


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.