Project:Computed Field
Version:6.x-1.0-beta3
Component:Documentation
Category:support request
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I may well be missing something very obvious, but I am receiving the following error whenever I try and create a node with a Computed field type in it:

Parse error: syntax error, unexpected '<' in {SERVER}/drupal/modules/computed_field/computed_field.module(138) : eval()'d code on line 1

Initially I thought it may be due to using tags in the PHP, but when I tried without, I still obtained this error!

What am I doing wrong? Please help!

Comments

#1

Paste your code? Probably just syntax error.
Be sure to use full <?php open tags, not just <?

#2

Hi!

Many thanks for the response!

The code I am using is:

$node_field[0]['value'] = $node->field_compoundformula[0]['value'];

#3

Getting the same problem, looking for solution.

Please post if you found something.

#4

Don't know if anyone is still having this problem, but what was causing this error for me was the fact that the Display Format field was using a WYSIWYG. So the field contained a p tag before the PHP code. Just changed the field to plain text and everything works...

#5

Version:6.x-1.0-beta2» 6.x-1.0-beta3

I have a very simple code on my test site that just multiplies two integers:
$node_field[0]['value'] = $node->Confidence1[0]['value'] * $node->Confidence2[0]['value'];

And I am getting the same error. When I edit a node and hit 'Save' I get the text below:
Parse error: syntax error, unexpected '<' in C:\...\modules\computed_field\computed_field.module(161) : eval()'d code on line 1

When I load the node thereafter just for viewing I get the same text, but with (297) instead of (161).

Has anything been figured out on this?

#6

I figured out the source of my problem - FCKeditor was affecting my "Computed Code" entry space, and was putting in markup. I deactivated FCKeditor, then went back and took the markup out of the Computed Code, and the error disappeared...

#7

I have the same problem when I run cron jobs manually. I am not using a wysiwyg module. my code is

$node_field[0]['value'] = $node->field_com_1_marks[0]['value']+ $node->field_com_2_marks[0]['value']+$node->field_com_3_marks[0]['value']+$node->field_com_4_marks[0]['value'];

#8

This should be put in the help text on the edit field page. The markup is inserted every time I access this page and needs to be removed prior to saving.

#9

Status:active» closed (fixed)

WYSIWYG editors will create chaos out of PHP code as they try to close >'s and generally "format" your code. This should be disabled within the WYSIWYG module you are using. Most popular ones offer the ability to exclude certain forms and/or paths. I'll add in a little help message to the form text.