I'm trying to place links in the footer of the calender view, but I can't get the URL to resolve properly.
The $base_url in settings.php is 'mysite.com/drupal5'.
So the link URL I'm trying to create is 'mysite.com/drupal5/node/add/meeting'.
The PHP snippet is this:
<?php
global $user;
$output = '';
if (is_array($user->roles)) {
if (isset($user->roles [3]) || isset($user->roles [4]) || isset($user->roles [5]) || isset($user->roles [6]) ) {
$output .= '<a href="' . $base_url . 'node/add/meeting">Schedule a new Meeting</a><br />';
}
else {
$output .= '';
}
}
return $output;
?>
case 1: a href="' . $base_url . 'node/add/meeting"
produces the URL 'mysite.com/drupal5/calendar/2007/node/add/meeting'.
case 2: add leading / a href="' . $base_url . '/node/add/meeting"
produces the URL 'mysite.com/node/add/meeting' (the /drupal5/ bit is missing).
case 3: add leading ./ a href="' . $base_url . './node/add/meeting"
produces the URL 'mysite.com/drupal5/node/add/meeting'...
Which is great until I click on the year or month view and then I get loads of /calendar/2007/ etc argument stuff re-inserted into the URL! This is mightily confusing. Is there any way of bypassing this interference caused by calendar module's URL arguments ... ?
Comments
Comment #1
JohnG-1 CreditAttribution: JohnG-1 commentedAh-ha!! I've got it: just added the line
global $base_url;
at the beginning of the function. egComment #2
chromeyellow CreditAttribution: chromeyellow commentedHousecleaning.
Comment #3
chromeyellow CreditAttribution: chromeyellow commented