<?php print $base_path; ?> Links to the front page with default language, So If site's default language is set to A and a user has selected language B, this code redirects user to the front page with language A.

Is there away to link to front page while keeping the current selected language?


Use the following code:

<?php print url('<front>', array('absolute' => TRUE)); ?>
| improve this answer | |

You can use a shorter version if you don't need your links to be absolute (usually needed for links displayed outside your website).

<?php echo url('<front>'); ?>

And also an even shorter version since the default value of the path is actually "front".

<?php echo url(); ?>

Documentation of the "url" function is here for Drupal 7 and Drupal 6 respectively. Note that what I previously stated is correct for both versions.




| improve this answer | |

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.