Jump to content

Displaying Something Depending On A Pilots Hub - {SOLVED}


Recommended Posts

Posted

Hi All,

Ok so the plan is that if want to add a section in the pilot cntre that shows according to a pilots hub so, for example, If Joe Bloggs Was in EGKK, it would show hub information.

I am aware that it might be possible using a "if" statement but at the moment my knowledge of php isn't helping. I thought about using something like the code which shows different parts of the nav-bar but that would involve groups.

Help Appreciated,

Jon Derrick

www.leavirtual.com

  • Administrators
Posted

On the pilot center page you can use the $userinfo variable to determine the hub the pilot is in;

<?php
   if($userinfo->hub == 'EGKK')
       {
           //do stuff here
       }
?>

Posted

Ok I want to display an Image for each pilot showing their Hub. And I also want To show an image for the Staff e-mail login:

However I'm getting the following error:

Parse error: syntax error, unexpected '<' in /home/leavirtu/public_html/lib/skins/Site/profile_main.tpl on line 180

Line 180 is where

<a href="http://www.leavirtual.com:2095"><img src="http://www.leavirtual.com/lib/skins/Site/images/profile/e-mail_staff.gif" width="200" height="100" border="0" /></a>

is.

<?php
if(Auth::LoggedIn())
{
if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN))
{
	<a href="http://www.leavirtual.com:2095"><img src="http://www.leavirtual.com/lib/skins/Site/images/profile/e-mail_staff.gif" width="200" height="100" border="0" /></a>
}
?>

<?php 
   if($userinfo->hub == 'EGLC') 
       { 
          <img src="http://www.leavirtual.com/lib/skins/Site/images/profile/eglc.gif" width="200" height="100" />
       } 
?>

Am I doing it wrong? Ahd a look at using the php mehtod image showing but doesn't make sense,

Help Apprciated,

Jon

  • Administrators
Posted

When you are working inside of php tags you need to use the print or echo syntax to get the html to the browser.

There are a few ways you can get this done. Two of them would be;

<?php  
   if($userinfo->hub == 'EGLC')  
       {  
          echo '<img src="http://www.leavirtual.com/lib/skins/Site/images/profile/eglc.gif" width="200" height="100" /> ';
       }  
?>

or if there is a lot of html to parse it is sometimes easier to end your php coding and then restart it after your html syntax

<?php  
   if($userinfo->hub == 'EGLC')  
       {  
     ?>

          <img src="http://www.leavirtual.com/lib/skins/Site/images/profile/eglc.gif" width="200" height="100" />

<?php 
       }  
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...