It seems nevertheless rather simple, but I do not find the solution.

How to print in node.tpl.php the url of the login page?

The url has to serve for a link:

<a href="<?php print ... ?>"><span>Login</span></a>

1 Answer 1


Use this if you just want the URL:

<?php print url('user/login'); ?>

If you want to print a link:

<?php print l(t('Login'), 'user/login'); ?>

And in your case it would be:

<?php print l('<span>' . t('Login') . '</span>', 'user/login', array('html' => TRUE)); ?>
  • Thanks Aram, i have an error: page not found. I indeed need only the url. It is the difficulty. For information I use pathauto, I do not know if it interferes.
    – Fluidouix
    Commented Mar 2, 2016 at 16:28
  • Not completely clear; so when you go to yourwebsite.com/user/login you get a 404? Commented Mar 2, 2016 at 16:29
  • No, i have a 404 when I click the generated link. The page yourwebsite.com/user/login works. The error message is : The page "/mysite/articles/user/login " was not found.
    – Fluidouix
    Commented Mar 2, 2016 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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