PHP - help me with the if statement in php/smarty?

Mark K

New member
I'm looking to use the {if} statement. I have an address field $address, and only want to show the address on the page if it is filled in. Presumably I'll do this with if and else statements but need more detail.

this is the code
<a href="{$ADDRESS|escape|trim}" title="{$ADDRESS|escape|trim}">{$CACHE_TITLE|escape|trim}</a>

how do i get the code to do If address field is empty, then else display "No address"

thanks
 
Before I show you the simple code, you need to know that "!" is practically a replacement for "ifexists","ifnull", and "isfalse".
if(!$adress){ // if $address does not exist
echo "This user did not supply their adress.";
}else{
echo $address;
}
Good Luck!
If you need further assistance/advice, feel free to contact me.
 
Back
Top