开发者

Simple computed field configuration in Drupal 6

I have one field called field_domain

I have a computed field called field_graph

field_domain is filled in by the user. For example it could be: dr开发者_JAVA百科upal.org

I need computed field to inject the value of field_domain as a variable into field_graph, like so:

<a href='http://siteanalytics.compete.com/drupal.org/?metric=uv'><img src='http://grapher.compete.com/drupal.org_uv.png' /></a>

So field_domain is turned into a variable and put into the html

Example:

field_domain has a value of drupal.org. This value gets turned into a variable of $domain

Computed field outputs:

<a href='http://siteanalytics.compete.com/$domain/?metric=uv'><img src='http://grapher.compete.com/$domain$under.png' /></a>

Putting the value of field_domain into wherever $domain is.

I have the code to do the conversion, put I don't know how to put it into computed field:

<?php
$domain = "drupal.org";
$under = "_uv";
echo "<a href='http://siteanalytics.compete.com/$domain/?metric=uv'><img src='http://grapher.compete.com/$domain$under.png' /></a>";
?>


You have access to a number of variables in the computed field. It tells you right there where you create it - see the help text below the text area where you type in your PHP? Also, where is $under coming from? If it's not hard coded, you'd have to change this code a little, but here's the gist:

$domain = $node->field_domain[0]['value'];
$node_field[0]['value'] = "<a href='http://siteanalytics.compete.com/$domain/?metric=uv'><img src='http://grapher.compete.com/{$domain}_uv.png' /></a>";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜