bcawebadmin's blog

URL tricks

If you want to create a link on a page but don't want it to break if it is in http://www.boiseclimbers.org/test-site or http://www.boiseclimbers.org, you can do this:

<a href="<?php echo url(NULL, NULL, NULL, TRUE); ?>bca-board-members">BCA Board</a>

or this:

<?php echo l("BCA Board", "bca-board-members", array(), NULL, NULL, FALSE, TRUE); ?>

The PHP code above will turn into whatever is the root of the Drupal installation you are using:

BCA Board

One point to note is that that the first one doesn't require "PHP code" for the input format - it appears to work just fine in "Full HTML" mode as well. For the second one, however, "PHP code" input format seems to be required.

Syndicate content