Q:

Drupal - print current URL as link, but remove the final argument

I'm trying to add a 'back' link within page.tpl.php (replacing a proper breadcrumb for a certain content type...).
My goal is to create a link that pulls in the current URL, but removes the final argument. So a page mysite/x/y would have a link mysite/x/ (or mysite/x).
Is this possible? (The URLs are aliased). 
<?php
$path = ???

$my_link = l('Back', $path);
?>

<?php if (($node->type == 'marketplace_item')): ?>
   <div id="breadcrumb" class="nav"><?php print $my_link; ?></div>
<?php endif; ?>

Cheers,
James

A:

if this the case always you can build the URL manually
$my_link = $base_url . arg(0);
or count the args then remove the last one 

