这是php代码:
<?php
$tid = $job_node->field_job_cv_destination['und'][0]['tid'];
$term = taxonomy_term_load($tid);
$name = $term->name;
?>
这就是错误:
ParseError: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in -
rules_php_eval()(第2行 - / web / maavarim / sites / all / modules / contrib / rules / modules / php.eval.inc(125):eval()&#39; d code)
任何人都知道该怎么办?
答案 0 :(得分:0)
尝试按以下方式实施您的代码
function mytheme_preprocess_page(&$vars, $hook) {
if (isset($vars['node']) && in_array($vars['node']->type, array('article', 'column'))) {
// Set header to topic for articles and columns
// @TODO: consider primary topic field (no multiselect), default to below if empty
$term = taxonomy_term_load($vars['node']->field_topic_ref[LANGUAGE_NONE][0]['tid']);
$vars['head_title'] = $term->name;
}
else {
$vars['head_title'] = $vars['title'];
}
}