Issue with views and php i'm using a view thats pulls data from a certain node via refference and i show non logged in users a error that they need to login, but i need to show a special node/add link with the nid in it. i'v got the code and it works without the if statement, in the if statement, my code is not working..

&lt;?php global $user;if (!$user-&gt;uid){print '&lt;div class="messages error"&gt;&lt;h4 class="alert-heading logged_out"&gt;Oops!&lt;/h4&gt;&lt;p&gt;tekst hier&lt;/p&gt;&lt;/div&gt;';}else{
 (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {  $nid = arg(1);print '&lt;a class="btn" href='/node/add/album&amp;field_band[]=$nid'&gt;Voeg een album toe!&lt;a/&gt;';} ?&gt;



&lt;?php  if (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {  $nid = arg(1);print '&lt;a class="btn"  href='/node/add/album&amp;field_band[]=$nid'&gt;Voeg een album toe!&lt;a/&gt;';} ?&gt;


the code above works, but not when its in the if/else block...

Please note that i don't have great knowledge about php.

Thanks!
You should write the if-else structure like:



&lt;?php 
global $user;
if (!$user-&gt;uid) {
   print '&lt;div class="messages error"&gt;&lt;h4 class="alert-heading logged_out"&gt;Oops!&lt;/h4&gt;&lt;p&gt;tekst hier&lt;/p&gt;&lt;/div&gt;';
}
else if(arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {  
    $nid = arg(1);
    print '&lt;a class="btn" href='/node/add/album&amp;field_band[]=$nid'&gt;Voeg een album toe!&lt;a/&gt;';
} 


?>



Note that after 'else' you want to test some conditions so you need to put an 'if' statement in front of your test.