这是个非常无聊而无奈的问题,昨晚在解决globalrediect模块的重定向循环问题,我的drupal终于可以开发seo相关的各个功能。
第一时间跑去设置各个页面的关键字,结果立即被打击的不行,只要一点击Add page keyword,立即报错:
Notice: Undefined variable: keyword 在 kwresearch_page_keywords_edit() (行 419 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit() (行 419 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined variable: keyword 在 kwresearch_page_keywords_edit() (行 422 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit_form() (行 445 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_load_page_keyword() (行 639 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.module).
Notice: Undefined variable: msgs 在 kwresearch_load_page_keyword() (行 641 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.module).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit_form() (行 456 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined property: stdClass::$priority 在 kwresearch_page_keywords_edit_form() (行 484 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined variable: output 在 kwresearch_page_keywords_edit() (行 422 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
打开keyword search模块对应的文件一看,kwresearch.admin.inc被调用的代码:
function kwresearch_page_keywords_edit($pid, $kid = 'add') {
if ($kid > 0) {
$sql = '
SELECT *
FROM {kwresearch_keyword}
WHERE kid = %d
';
$keyword = db_fetch_object(db_query($sql, $kid));
drupal_set_title(t('Edit page keyword'));
}
if (!$keyword->keyword) {
drupal_set_title(t('Add page keyword'));
}
$output .= render(drupal_get_form('kwresearch_page_keywords_edit_form', $pid, $keyword));
return $output;
}
然后是kwresearch.module文件中调用代码
$items['admin/structure/kwresearch/page_keywords_edit'] = array(
'title' => t('Add page keyword'),
'page callback' => 'kwresearch_page_keywords_edit',
'access callback' => 'user_access',
'access arguments' => array('kwresearch admin page keywords'),
'type' => MENU_CALLBACK,
'file' => 'kwresearch.admin.inc',
);
我10多年前,还在大学年说的时候使用过php,后来刚毕业时还用php写过几个简单的网站,但是现在快10年了,php的语法基本忘光了,不过从错误信息上看,貌似是调用时给的参数有问题,造成 if ($kid > 0) { 这个代码块没有被支持,$keyword没有被初始化和赋值,晕。
去keyword search模块的网站上看了一下,已经有两个issue提到同样的问题,已经几个月了,不见fix。晕倒,这都什么代码质量啊?
第一时间跑去设置各个页面的关键字,结果立即被打击的不行,只要一点击Add page keyword,立即报错:
Notice: Undefined variable: keyword 在 kwresearch_page_keywords_edit() (行 419 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit() (行 419 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined variable: keyword 在 kwresearch_page_keywords_edit() (行 422 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit_form() (行 445 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Trying to get property of non-object 在 kwresearch_load_page_keyword() (行 639 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.module).
Notice: Undefined variable: msgs 在 kwresearch_load_page_keyword() (行 641 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.module).
Notice: Trying to get property of non-object 在 kwresearch_page_keywords_edit_form() (行 456 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined property: stdClass::$priority 在 kwresearch_page_keywords_edit_form() (行 484 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
Notice: Undefined variable: output 在 kwresearch_page_keywords_edit() (行 422 在 /home/content/a/o/x/aoxiaojian/html/sites/all/modules/kwresearch/kwresearch.admin.inc).
打开keyword search模块对应的文件一看,kwresearch.admin.inc被调用的代码:
function kwresearch_page_keywords_edit($pid, $kid = 'add') {
if ($kid > 0) {
$sql = '
SELECT *
FROM {kwresearch_keyword}
WHERE kid = %d
';
$keyword = db_fetch_object(db_query($sql, $kid));
drupal_set_title(t('Edit page keyword'));
}
if (!$keyword->keyword) {
drupal_set_title(t('Add page keyword'));
}
$output .= render(drupal_get_form('kwresearch_page_keywords_edit_form', $pid, $keyword));
return $output;
}
然后是kwresearch.module文件中调用代码
$items['admin/structure/kwresearch/page_keywords_edit'] = array(
'title' => t('Add page keyword'),
'page callback' => 'kwresearch_page_keywords_edit',
'access callback' => 'user_access',
'access arguments' => array('kwresearch admin page keywords'),
'type' => MENU_CALLBACK,
'file' => 'kwresearch.admin.inc',
);
我10多年前,还在大学年说的时候使用过php,后来刚毕业时还用php写过几个简单的网站,但是现在快10年了,php的语法基本忘光了,不过从错误信息上看,貌似是调用时给的参数有问题,造成 if ($kid > 0) { 这个代码块没有被支持,$keyword没有被初始化和赋值,晕。
去keyword search模块的网站上看了一下,已经有两个issue提到同样的问题,已经几个月了,不见fix。晕倒,这都什么代码质量啊?