James142 Posted October 21, 2010 Report Posted October 21, 2010 I was looking for this code as I want to put a link on the frond page saying: there are 5 xacars flights - click hee to view Thanks for all the help, james Quote
Guest lorathon Posted October 21, 2010 Report Posted October 21, 2010 Use this there are <?php echo count(ACARSData::GetACARSData());?> xacars flights - click <a href="<?php echo SITE_URL?>/index.php/acars">here</a> to view Quote
James142 Posted October 22, 2010 Author Report Posted October 22, 2010 Use this there are <?php echo count(ACARSData::GetACARSData());?> xacars flights - click <a href="<?php echo SITE_URL?>/index.php/acars">here</a> to view Thats great! thank you so much! Quote
James142 Posted October 22, 2010 Author Report Posted October 22, 2010 Use this there are <?php echo count(ACARSData::GetACARSData());?> xacars flights - click <a href="<?php echo SITE_URL?>/index.php/acars">here</a> to view I was also just thinking, is there anyway to make the text to not show up when there are no xacar flights? Quote
Administrators simpilot Posted October 22, 2010 Administrators Report Posted October 22, 2010 You can assign the count to a variable like $pilotsflying = count(ACARSData::GetACARSData()); then use an if command to check to see if the count is greater than 0 if($pilotsflying > 0) { Do Stuff } Quote
James142 Posted October 22, 2010 Author Report Posted October 22, 2010 You can assign the count to a variable like $pilotsflying = count(ACARSData::GetACARSData()); then use an if command to check to see if the count is greater than 0 if($pilotsflying > 0) { Do Stuff } I'm not so great with php coding, but where do i put the if($pilotsflying > 0) { Do Stuff } ? I have tried putting the code all over the place but it doesnt work? one way i did it was this way: <marquee align="left" direction="left" onmouseover="this.stop();" onmouseout="this.start();" behavior="scroll" width="600"></i>There are <?php echo count(ACARSData::GetACARSData());?> if($pilotsflying > 0) { <i>currently no</i> } xacars flights - </i><b>click here to view </b></marquee></ which is wrong as it does not come out There are if($pilotsflying > 0) { <i>currently no</i> } xacars flights - </i><b>click here to view. sorry if this seems like a stupid question:S, James Quote
Administrators simpilot Posted October 22, 2010 Administrators Report Posted October 22, 2010 try something like this <?php $pilotsflying = count(ACARSData::GetACARSData()); echo '<marquee align="left" direction="left" onmouseover="this.stop();" onmouseout="this.start();" behavior="scroll" width="600">'; if($pilotsflying > 0) { echo 'There are '.$pilotsflying.' xacars flights - click <a href="'.SITE_URL.'/index.php/acars">here</a> to view'; } else { echo 'Welcome to our site'; } echo '</marquee>'; ?> Quote
James142 Posted October 22, 2010 Author Report Posted October 22, 2010 try something like this <?php $pilotsflying = count(ACARSData::GetACARSData()); echo '<marquee align="left" direction="left" onmouseover="this.stop();" onmouseout="this.start();" behavior="scroll" width="600">'; if($pilotsflying > 0) { echo 'There are '.$pilotsflying.' xacars flights - click <a href="'.SITE_URL.'/index.php/acars">here</a> to view'; } else { echo 'Welcome to our site'; } echo '</marquee>'; ?> That is brilliant, thank you so much!! James Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.