關於向drupal中添加js的問題
PHP code
//請問大家有熟悉drupal的嗎?我想在user.module中的user_authenticate函數中插入一段script,請問如何做?function user_authenticate($name, $pass) { global $user; // Try to log in the user locally. Don't set $user unless successful. if ($account = user_load(array('name' => $name, 'pass' => $pass, 'status' => 1))) { // Check if the e-mail is denied by an access rule. // Doing this check here saves us a user_load() in user_login_validate() // and introduces less code change for a security fix. if (drupal_is_denied('mail', $account->mail)) { form_set_error('name', t('The name %name is registered using a reserved e-mail address and therefore could not be logged in.', array('%name' => $account->name))); return; } else {//我想在登陸成功後在這裡插入一段script,請問如何插入,試了一個晚上,用drupal_add_js總是不行 $user = $account; return $user; } }
------解決方案--------------------
樓主真逗!~
PHP是伺服器語言 JS是用戶端語言 怎可同日而語?
除非你將JS設定成Server 或者 在PHP中用上echo('');輸出到用戶端運行
------解決方案--------------------
你要插入什麼JS?
echo '';
------解決方案--------------------
探討
引用:
你要插入什麼JS?
echo ' ';
我以前就是這麼寫的,但在user.module中使用echo是不行的,所以才來問的
------解決方案--------------------
加了JS後,面頁有沒有說面頁有錯誤之類的東東?
------解決方案--------------------
那考慮用層來做提示吧!
echo "這裡插入提示之類語言!";
------解決方案--------------------
那這樣呢
else {
?>
$user = $account;
------解決方案--------------------
探討
在user.module中使用Echo script後,在使用者登陸後,則變成第一屏是白屏,再刷一次,才能到正常頁面
------解決方案--------------------
drupal在國內的普及度本來就不高,何不到drupal.org的論壇去問問呢?
------解決方案--------------------
探討
引用:
你要插入什麼JS?
echo ' ';
我以前就是這麼寫的,但在user.module中使用echo是不行的,所以才來問的
------解決方案--------------------
請問樓主的qq是多少啊告訴我