hi
how do i declare an IF statement inside an IF statement?
the one I am looking at now is:
if($context['TPortal']['dlaction']=='item')
echo '
<a href="'.$dlitem['href'].'"><img src="' . $settings['images_url']. '/TPdownloadfile.gif" border="0" align="right" alt="" /></a>';
I want it to be something like:
global $user_info;
if ($user_info['is_guest'])
echo
if($context['TPortal']['dlaction']=='item')
echo '
<a href="....link here......"><img src="' . $settings['images_url']. '/TPdownloadfile.gif" border="0" align="right" alt="" /></a>';
else
echo
if($context['TPortal']['dlaction']=='item')
echo '
<a href="'.$dlitem['href'].'"><img src="' . $settings['images_url']. '/TPdownloadfile.gif" border="0" align="right" alt="" /></a>';
so basically it will check if the user is a guest then it will give them another link otherwise give them the original link
thanks
aku
You need to use brackets.If (something)
{
code;
if (something2)
{
code;
}
else
{
code;
}
}
elseif (something)
{
code;
}
else
{
code;
}
Thanks figured it out :D
global $user_info;
if (($user_info['is_guest'])&&($context['TPortal']['dlaction']=='item'))
echo '
<a href="....link here......"><img src="' . $settings['images_url']. '/TPdownloadfile.gif" border="0" align="right" alt="" /></a>';
else
echo '
<a href="'.$dlitem['href'].'"><img src="' . $settings['images_url']. '/TPdownloadfile.gif" border="0" align="right" alt="" /></a>';
now we have Guests can only view in TP
and members can download
woo hoo :D
PS: do u think the 2 statements are basically the same or will there be differences ? (in ur professional opinion as a php coder)
nope dosent have any adverse side effects :D
Thanks for the help