我为节点和块设置了一些术语,我想从页面中获取参数,但页面是这样的:
但这些条款在页面上如下:
TERM1
如何让块获取term1 arg并显示其他具有term1的节点?
答案 0 :(得分:0)
你不能只用PHP从页面中获取数据(没有某种复杂的HTML树解析)。相反,我建议从节点本身获取术语数据。请考虑以下事项:
$node = node_load(arg(1));
// If you're on Drupal 6:
$terms = taxonomy_node_get_terms($node);
// If Drupal 7, your terms should be stored as a term reference field on the node.
$terms = field_get_items('node', $node, 'YOUR TERM REFERENCE FIELD');
foreach ($terms as $term) {
// Do stuff here.
}