运行drupal 7.22,我需要添加一个选项来排序视图 - 与Curses相关的内容类型Lecture。
在Curse页面中,我需要按特定顺序显示Lecture。
讲座以下列方式发送
print views_embed_view('lecture_list_of_online_courses','block', $node->nid);
我尝试了以下简单的解决方案 -
结果:视图显示的排序似乎与我添加到' my_wight'
的值无关我以前曾多次与drupal合作,并且不止一次地做过这类事情。
我可以解决这个问题。
这是来自View -
的结果SQL查询SELECT node_field_data_field_oc_forum_reference.nid AS node_field_data_field_oc_forum_reference_nid, node_field_data_field_oc_forum_reference.title AS node_field_data_field_oc_forum_reference_title, node_field_data_field_oc_forum_reference.language AS node_field_data_field_oc_forum_reference_language, node_field_data_field_oc_forum_reference.type AS node_field_data_field_oc_forum_reference_type, node_field_data_field_oc_forum_reference.comment AS node_field_data_field_oc_forum_reference_comment, field_data_field_lecture_weight.field_lecture_weight_value AS field_data_field_lecture_weight_field_lecture_weight_value, 'node' AS field_data_body_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_oc_forum_reference} field_data_field_oc_forum_reference ON node.nid = field_data_field_oc_forum_reference.entity_id AND (field_data_field_oc_forum_reference.entity_type = 'node' AND field_data_field_oc_forum_reference.deleted = '0')
INNER JOIN {node} node_field_data_field_oc_forum_reference ON field_data_field_oc_forum_reference.field_oc_forum_reference_nid = node_field_data_field_oc_forum_reference.nid
LEFT JOIN {field_data_field_lecture_weight} field_data_field_lecture_weight ON node.nid = field_data_field_lecture_weight.entity_id AND (field_data_field_lecture_weight.entity_type = 'node' AND field_data_field_lecture_weight.deleted = '0')
WHERE (( (node.nid = '175' ) )AND(( (node.status = '1') AND (node.type IN ('online_courses')) )))
ORDER BY field_data_field_lecture_weight_field_lecture_weight_value DESC
我无法运行此查询 - 任何想法为什么?
答案 0 :(得分:0)
首先 - 要使SQL正常工作,您必须删除' {'和'}'来自查询
第二 - 在创建SORT CRITERIA时,您需要选择' Relationship'在SORT CRITERIA的设置中