In a custom user-login-block.tpl.php file i want to make a link in the Create an Account -button which links to /doctor/register. Here the link to the example page (you are redirected to this page from specific nodes who needs permission (by Content Access module).

How do i make this link in PHP so i am able to make it multilingual and translate it in Administration » Configuration » Regional and language » Translate interface to:

  • benl/doctor/register (for Belgium dutch site)
  • befr/doctor/register (for Belgium French site)

I think i need somehow the base_url because otherwise it gives the string from the restricted page (in this example benl/producten/injectables).

How do i manage this?


To make it more clear this is my HTML:

<div class="well">
    <a class="btn btn-large btn-primary" href="HERE THE LINK"><?php print t('Create an Account'); ?></a>

So where is written HERE THE LINK i have to insert the php-code.

1 Answer 1


You can use path aliases for this. Go to /admin/config/search/path/add and create a new alias with the following settings:

  • Language: Dutch (or whatever it is called in your site)
  • Existing system path: 'doctor/register'
  • Path alias: 'dokter/registreer' (or whatever suits your fancy)

Repeat for the French site. Drupal core and contrib modules should automatically pick up the language-dependent aliases. If you're creating a link in a template yourself, make sure you use the l() function to build the entire <a> tag. To get the result in your question, you need something like this:

<div class="well">
    $link_options['attributes']['class'] = array('btn', 'btn-large',' btn-primary');
    print l(t('Create an Account'), 'doctor/register', $link_options);
  • and how do i place above exactly in the <a href="" ?
    – meez
    Jan 28, 2016 at 11:44
  • @MeesFrenkelFrank – This will create the whole anchor automatically. You can also add classes like so: <?php l(t('Create an account'), 'doctor/register', array('attributes' => array('class' => 'doc-reg-link'))); ?>.
    – leymannx
    Jan 28, 2016 at 12:13
  • @leymannx i update my question. I added my HTML. How do i integrate your example?
    – meez
    Jan 28, 2016 at 12:26
  • 2
    @MeesFrenkelFrank <div class="well"><?php print l(t('Create an Account'), 'doctor/register'); ?></div>
    – leymannx
    Jan 28, 2016 at 12:28
  • 1
    Thanks for your additions, @leymannx. I updated the answer to match the updated question. Jan 28, 2016 at 16:03

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.