I used a custom field with a small function in a view. Then i created a second view and again tried to make a small function (different name of course). And it tells me can not redeclare mySmallTestFunction().
I am 100% this function is not declared elsewhere.
So can i only use one customfield in all my views?

Comments

casey’s picture

Code gets executed for every row.

bis20’s picture

Do it That way:

1- create your custom module [testmodule]
2- create testmodule.install file with following syntax:

<?php
// $Id:
/**
* Implementation of hook_install().
*/
function testmodule_install() {
  $filename = drupal_get_path('module','testmodule') . "/testmodule.code.inc";
}

3- Create testmodule.code.inc file & place your Custom function on it.
4- goto your view and place the following code in Header of view:

<?php
module_load_include('inc', 'testmodule', 'testmodule.code');
?>

5- finally check the loading of include file in your custom php field by following function :

if (module_load_include('inc', 'testmodule', 'testmodule.code') !== FALSE) {

}

do not forget to flush caches.

B&R
Bis20

marcoka’s picture

Status: Active » Closed (works as designed)

i am not using drupal 6 anymore. i am on seven now. so i can not remember problem details, neither testing it.