سؤال

The following code works for me to redirect the user back to the previous current page after he/she logs in.

 <?php  
    print l(t('Please Log in'),'/user/login', array(
    'attributes' => array('title' => t('Log in page')),
    'query' => drupal_get_destination()));
    ?>

However, how can I add # to the previous current page?

For example, if the user was on /node/1 and go to the login page. Then How can I redirect this user to /node/1#article_1 ?

(How can I add this #article_1? )

هل كانت مفيدة؟

المحلول

This can be done via

<?php  
  print l(t('Please Log in'),'/user/login', array(
    'attributes' => array('title' => t('Log in page')),
    'query' => drupal_get_destination(),
    'fragment' => 'article_1'));
?>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى drupal.stackexchange
scroll top