關於向drupal中添加js的有關問題

來源:互聯網
上載者:User
關於向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是多少啊告訴我
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.