Conditional Page Links

Permalink
I have a series of pages which can only be viewed by people in specific groups. I want to put a series of links on a welcome page which apply only to those in that group. I can add the conditional text but not create it as a page link. I am struggling with the PHP.

I currently have the following in a PHP Block

$u = new User();
$g = Group::getByName('General Boating');
if($u->inGroup($g)) {
    echo "<h3>General Licence Boating Safety Course</h3>";
} else { 
    echo " "; 
}


I would like the <h3>General Licence Boating Safety Course</h3> to link to a page index.php?cID=143

I just need to know the syntax to add the link to the if/else statement.

regards

Ian

ianj
 
ianj replied on at Permalink Reply
ianj
Sorry my mistake. I managed to solve the problem by using single quote marks as follows

$u = new User();
$g = Group::getByName('General Boating');
if($u->inGroup($g)) {
    echo '<a href="./index.php?cID=143"><h3>General Licence Boating Safety Course</h3></a>';
} else { 
    echo " "; 
}