...

View Full Version : How do I put together this if else?



sfraise
03-12-2009, 10:47 PM
Currently a page will show a (send message) link using


<?php echo '&nbsp;<a href="compose.php?recipient='; ?>


But I would like to add and if else statement to it where if a non-paid member tries to send the person a message it will take them to mydomain.com/index.php?page=freemail. I've tried adding the following script before the above code but I can't get it to work. I'm sure I'm just not structuring it correctly.



<?php echo '&nbsp; {if $smarty.session.security.viewemail == '0' }
<a href="http://mydomain.com/index.php?page=freemail" >
{else}
<a href="compose.php?recipient='; ?>


Do I need to add a {/if} at the end also?

Fumigator
03-12-2009, 10:59 PM
Don't echo the "if" statement; instead use echos inside the "if" statement's blocks:



if ($smarty.session.security.viewemail == '0') {
echo '<a href="http://mydomain.com/index.php?page=freemail" >';
} else {
echo '<a href="compose.php?recipient=';
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum