我正在创建一个自定义模块和内容类型。并在我的页面上显示这些项目。我的模块是:
function theme_news(){
global $language;
$output = '';
drupal_set_title('News');
$m_query = db_select("node","n")->extend("PagerDefault")->limit(10);
$m_query->fields("n",array('nid','title','language'));
$m_query->condition('status','1',"=");
$m_query->condition('n.type','news','=');
//$m_query->condition('n.language',$language->language,'=');
$m_query->orderBy('n.sticky','desc');
if(arg(1) == 'latest_news'){
$m_query->join('field_data_field_etype','fe','n.nid=fe.entity_id');
$m_query->condition('fe.field_etype_value','ap','=');
if(arg(2) != ''){
$m_query->join('field_data_field_myear','fy','n.nid=fy.entity_id');
$m_query->condition('fy.field_myear_value',arg(2),'=');
}
}
if(arg(1) == 'feature_news'){
$m_query->join('field_data_field_etype','fe','n.nid=fe.entity_id');
$m_query->condition('fe.field_etype_value','sp','=');
if(arg(2) != ''){
$m_query->join('field_data_field_myear','fy','n.nid=fy.entity_id');
$m_query->condition('fy.field_myear_value',arg(2),'=');
}
}
此功能创建 2 个子菜单并显示这些子菜单中的内容。工作我的代码,但我不知道,为什么我看不到 field_myear 值。
我该如何解决?