1

I wanted to provide feature where non-logged in users can click on "Rate" button, which will lead them to login and after login they come back to the page. Upto this, it is working fine.

But I want user's to go to particular section of page, div with id = "id1".

How can I achieve this?

-- Many thanks for your time.

This is what I have tried:

$destination = drupal_get_destination();

$options = array( 'query' => $destination,'fragment'=>'div_id');

print l('Review', 'content/login', $options);
2

This works for me...

$destination = drupal_get_destination();
$destination['destination'] .= '#div_id';
$options = array( 'query' => $destination);
print l('Review', 'content/login', $options);
  • No I setting just redirect url with fragment in it. This is my code: $destination = drupal_get_destination(); $options = array( 'query' => $destination,'fragment'=>'tabs-0-region_'); print l('Review', 'content/login', $options); – Kalpesh Patel Mar 14 '13 at 14:07
  • Edited question – Kalpesh Patel Mar 14 '13 at 14:10
  • Hmmm try adding it to the $destination variable, something like $destination['path'] .= '#div_id'; – Clive Mar 14 '13 at 14:14
  • No luck, it didn't work. – Kalpesh Patel Mar 14 '13 at 14:26
  • Oops wrong array key, please see the updated answer – Clive Mar 14 '13 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.