login destination redirect to previous page adding #
This can be done via

&lt;?php  
  print l(t('Please Log in'),'/user/login', array(
    'attributes' =&gt; array('title' =&gt; t('Log in page')),
    'query' =&gt; drupal_get_destination(),
    'fragment' =&gt; 'article_1'));
?&gt;