Drupal 7 自定义页面如何向自定义的主题传参
来源:互联网 发布:bernsen二值化算法 编辑:程序博客网 时间:2024/06/06 08:52
根据 https://www.drupal.org/node/1560952 的介绍,我自定义了一个页面内容如下,数据都取到了,现在问题是数据没有按着实例传到主题变量中。
<?phpfunction metest_theme(){return array('metest'=>array('variables'=>array('output'=>null),'template'=>'metest',),);} function metest_menu(){$items=array();$items['rfid/showme']=array('title'=>t('ME'),'description'=>t('ME'),'page callback' => 'metest_page','access callback'=>TRUE,);$items['rfid-showme/%/%']=array('title'=>t('ME'),'description'=>t('ME'),'page callback' => 'metest_page_results','page arguments'=>array(1,2),'access callback'=>TRUE,);return $items;} function metest_page(){/* $dis=drupal_get_form('metest_kanban_form');return $dis; */return array('#markup'=>t('请选择左边栏'));}function metest_page_results($pro_date,$pro_line){$output=metest_get_me_result($pro_line,$pro_date);dpm($output);return theme('metest',array('output'=>$output));}function metest_block_info() { $blocks = array(); $blocks['mekanban'] = array( 'info' => t('ME'), 'cache' => DRUPAL_NO_CACHE, ); return $blocks;}function metest_block_view($delta = '') { $block = array(); switch ($delta) { case 'mekanban': $block['subject'] = t('ME'); $block['content'] = drupal_get_form('metest_kanban_form'); break;} return $block;}function metest_kanban_form($form, &$form_state){global $user;$options=metest_kanban_get_lines();$date_format='Y-m-d';$form=array();$pro_line=variable_get('me_pro_line'.$user->uid,$pro_line);$form['linelist']=array('#prefix'=>'<span class="right_arrow"></span>','#type'=>'select','#size'=>10,'#empty_option' => t('选择组'),'#options' => $options,'#default_value'=>$pro_line, ); $form['productiondate']=array('#type'=>'date_popup','#title'=>t('选择日期'),'#default_value'=>variable_get('me_pro_date'.$user->uid,date('Y-m-d')),'#date_format'=>$date_format,'#date_label_position'=>'within','#date_timezone'=>'Asia/Shanghai','#date_increment'=>60,'#date_year_rang'=>'-3:+3',); $form['submit']= array('#type' => 'submit','#value' => t('提交'),); return $form;}function metest_kanban_get_lines(){$options=array();$results=taxonomy_get_tree(12); foreach($results as $term ){$key=$term->tid;$value=$term->name;$term_load=taxonomy_term_load($term->tid);$options[$key]=$value;}return $options;}function metest_kanban_form_submit($form, &$form_state){$linelist=$form_state['values']['linelist'];$productiondate=$form_state['values']['productiondate'];if(!empty($linelist)&& !is_null($productiondate)){global $user;variable_set('me_pro_date_'.$user->uid,$productiondate);variable_set('me_pro_line_'.$user->uid,$linelist);drupal_goto(file_create_url('/rfid-showme/'.$productiondate.'/'.$linelist));}}function metest_get_me_result($line,$prodate){$query=db_select('node','n');//...$query->OrderBy('n.created','DESC');$result=$query->execute()->fetchAll(); return $result;}在metest.tpl.php中读$output,但没有成功,不知道是何原因,模板文件放在jean自定义的主题文件夹内../jean/template/metest.tpl.php
<?php dpm($output);?>此图是metest_page_results()中的dpm输出的调试,说明数据取到了,现在最关键就在后面的theme()没有传递成功。
0 0
- Drupal 7 自定义页面如何向自定义的主题传参
- Drupal 自定义主题实体 Theming Custom Entities
- 如何创建自定义主题
- Drupal 6 自定义用户登陆、注册页面
- 如何在Drupal 7当中开发自己的主题?
- 如何使用Drupal 7 Skeleton主题?
- Android如何自定义MaterialDesign主题
- Drupal 7中怎样添加自定义的CSS样式
- Drupal 主题的表现形式
- drupal的theme主题
- 如何自定义跳转页面
- 如何通过自定义主题创建背景透明的activity
- 为 Drupal 7 网站添加自定义CSS
- 自定义主题
- 自定义主题
- drupal 自定义block
- drupal 自定义权限
- drupal自定义node权限
- Class.forName与ClassLoader(转)
- 反记账对BSEG和FAGLFLEXA的影响
- 多线程同步方法
- thinkphp链接oracle
- Jenkins进阶系列之——01使用email-ext替换Jenkins的默认邮件通知
- Drupal 7 自定义页面如何向自定义的主题传参
- PullToRefreshListView不显示
- Android 中 PopupWindow 的用法
- UIAlertController 在didSelectRowAtIndexPath里 有时候点了半天才出来
- 您现在只需免费与相机捆绑即可购买一个PSVR
- 做点击操作时的错误WebDriverException: unknown error: Element is not clickable at point (958, 207).
- Retrofit请求数据对错误以及网络异常的处理
- 简单检测mysql主从正常与否的脚本
- Docker数据卷报错的解决[Wrong volume permissions?]