1

Drupal で、「求人投稿」ノード コンテンツ タイプの cck フィールドから「求人応募」ノード コンテンツ タイプのこの計算フィールドに電子メール アドレスをコピーする cck 計算フィールドを作成しようとしています。cck 計算フィールドの [Computed Code:] ボックスに貼り付けると、次のコードが完全に機能することがわかりました。

// obtain node id from nodereference cck field that links 
// the job application node to the job post node
$item_nid = $node->field_appl_position[0]['nid'];

//load and build the information from the referenced job post node
$item_node = node_load($item_nid);
$item_node = node_build_content($item_node);

//get the email address from the cck email field in the referenced job post node
$item_email = $item_node->field_job_email[0]['email'];

//copy the email address to the computed field in the job application node
$node_field[0]['value'] = $item_email;

ただし、計算フィールドの内容を使用して電子メールを送信しようとしても、何も起こりません。これは、計算フィールドが mailto リンクとしてフォーマットされていないためだと思います。計算フィールドの「表示形式:」ボックスのパラメータを変更しようとしましたが、成功しませんでした。誰でも助けてもらえますか?ありがとう!

4

1 に答える 1

0

次の Drupal API 関数を使用して、リンクをフォーマットできます。

http://api.drupal.org/api/drupal/includes--common.inc/function/l/6

したがって、この場合、計算フィールドの値は次のようになります。

l('Mail me', 'mailto:'.$item_email);
于 2010-12-06T14:14:27.110 に答える