Active
Project:
Dript - A Scripting Language for Drupal
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
17 Mar 2007 at 20:08 UTC
Updated:
18 Mar 2007 at 18:54 UTC
I did some testing using dript calls within a computed field on a node with other computed fields and got a range of inconsistent results.
There were two sets of tests, the first featuring a simple print statement and the second featuring a node-fields statement.
Each test cycled through using the dript calls with dript, dripte, driptn and driptne.
The test call is displayed for variable Test 3 and the results are then displayed. In some cases, the two non-dript variables are prevented from displaying. These are the results
============================
First Round of tests using (print testdript)
============================
Test: $node_field[0]['value'] = "testing";
Test 2: global $user;
$node_field[0]['value'] = $user->name;
Test 3: $node_field[0]['value'] = "[dript (print testdript)/]"
Test 3:
[dript (print testdript)/
Test 2:
druadmin
Test:
testing
============================
Test 3: $node_field[0]['value'] = "[dripte (print testdript)/]";
Test 3:
[dripte (print testdript)
Test 2:
druadmin
Test:
testing
============================
Test 3: $node_field[0]['value'] = "[driptn (print testdript)/]";
Test 3:
testdript
============================
Test 3: $node_field[0]['value'] = "[driptne (print testdript)/]";
Test 3:
testdriptfield field-type-computed field-field-test-2>field-label>Test2:field-items>field-item>druadminfield field-type-computed field-field-test>field-label>Test:field-items>field-item>testing
testdriptfield field-type-computed field-field-test-2>field-label>Test2:field-items>field-item>druadminfield field-type-computed field-field-test>field-label>Test:field-items>field-item>testing
============================
Second Round of tests using (node-fields 275)
============================
Test: $node_field[0]['value'] = "testing";
Test 2: global $user;
$node_field[0]['value'] = $user->name;
Test 3: $node_field[0]['value'] = "[dript (node-fields 275)/]";
Test 3:
[dript (node-fields 275)/
Test 2:
druadmin
Test:
testing
============================
Test 3: $node_field[0]['value'] = "[dripte (node-fields 275)/]";
Test 3:
[dripte (node-fields 275)
Test 2:
druadmin
Test:
testing
============================
Test 3: $node_field[0]['value'] = "[driptn (node-fields 275)/]";
Test 3:
============================
Test 3: $node_field[0]['value'] = "[driptne (node-fields 275)/]";
Test 3:
("test" "test_2" "test_3")
Comments
Comment #1
chelahmy commented1. Only use driptn or driptne to evaluate expression inside a node. dript and dripte are used in conjunction with input format which are useful to evaluate expression inside block or comment.
2. driptn and dript require (print) function to output the result. While driptne and dripte will output the result of the last expression.
3. Using dript or dripte inside a node will do nothing.
4. The results of the test generally look okay to me except this one:
No need to use (print) with driptne. However, that is not a restriction. I'll have a further look on this one.
Comment #2
jarea commentedThanks for the reply that is helpful.
Based on your comments, it appears that dripts can only be used in a node or in an input format (presumably in the PHP code window). Does this mean that dript is not usable with computed fields?
When using a dript call in a computed field, Second Round / Test 3 is producing the result that I expect, except for some reason whenever dript delivers a valid result, the other two computed fields (test and test 2) wind up missing. Any idea why is that happening?
Thanks - jarea