How can I print a link to my front page in a block tpl template file?

Ive tried the following:
<a href="<?php print check_url($front_page) ?>"

And it sort of works, it creates an href where the link destination is empty. This is working on my current browser but will it work on all? Is it better to use absolute not relative links?

Thanks

Comments

Jaypan’s picture

print l(t('Home'), '');

This will generate the whole link (anchor tag and all) and will even work if you change your front page to a different page at some time.

Jaypan’s picture

Dubble poste.

jdln’s picture

Works great. Thanks

jdln’s picture

How can I just print the url? I want to put an image inside my link.
Thanks

Jaypan’s picture

print l('Only local images are allowed.', '', array('html' => TRUE));
jdln’s picture

Thanks

makbul_khan8’s picture

$image = theme('image', drupal_get_path('module', 'mymodule') .'/images/image_1.png', t('This is the alt tag.'), t('This is the title tag.'));

// Additionally, create a link using that image.
$link = l($image, 'mymodule/menu_1', array('html' => TRUE));
jdln’s picture

Ive been using the following:

		<div id="beforefooter"><?php print l('<img src="imagesmy/logo.jpg" />', '<front>', array('html' => TRUE)); ?></div>
        <?php print $footer; ?>
		<div id="afterfooter">
			<a href="http://www.site.com" target="_blank" >
				<img src="imagesmy/credit.jpg" />
			</a>
		</div>

It works fine on most pages, but the images dont show up on admin pages and some user pages (that you have to be logged in to see). From looking at the source code of the page it seems like their idential, so im really confused by this.

Thanks

jdln’s picture

Fixed with:

print l('<img src="' . base_path() . 'imagesmy/logo.jpg" />', '<front>', array('html' => TRUE));

and 

<img src="<?php print $base_path ?>/imagesmy/credit.jpg" />