Drupal 6 中的简单计算字段配置
我有一个名为 field_domain 的字段
我有一个名为 field_graph 的计算字段
field_domain 由用户填写。例如,它可能是: drupal.org
我需要计算字段将 field_domain 的值作为变量注入到 field_graph 中,如下所示:
<a href='http://siteanalytics.compete.com/drupal.org/?metric=uv'><img src='http://grapher.compete.com/drupal.org_uv.png' /></a>
因此 field_domain 变成变量并放入 html
示例:
field_domain 的值为 drupal.org 。该值变成 $domain 的变量
计算字段输出:
<a href='http://siteanalytics.compete.com/$domain/?metric=uv'><img src='http://grapher.compete.com/$domain$under.png' /></a>
将 field_domain 的值放入 $domain 所在的位置。
我有进行转换的代码,但我不知道如何将其放入计算字段中:
<?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>";
?>
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: drupal.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>";
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以访问计算字段中的许多变量。它会告诉您创建它的位置 - 请参阅您在其中输入 PHP 的文本区域下方的帮助文本吗?另外,$under 从哪里来?如果不是硬编码,您必须稍微更改此代码,但要点如下:
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: