Jump to content

pilot_list.tpl - Advancing the page.


Recommended Posts

Posted

I have added extra profile fields and now wish to make the page abit more advanced. I have a section that now says if the pilot is either Active or Inactive. The text that Staff can input is Active/ Inactive, how can I get it to show images instead of plain text?

Posted

Im not understanding what you have done clearly. The best way to accomplish your goal is to make a new group called in-active pilots and simply change the pilots association with a group ( Either Active, In-active ) as the situation presents itself. Now in that case, you cannot change the plain text because its in a form. Image association is very simple, but please explain your exact problem more clearly and I might be able to help you better.

With regards,

Jake

Posted

Ok, I have added a new 'Profile Field' which is text. I have added this field to show up on pilots_list.tpl, on this list it will either say ACTIVE or INACTIVE. This looks too plain, and therefore I am asking if there is a code that would for example place an image on the pilots_list.tpl if ACTIVE is placed in that field insted of boring text.

Posted

Again, since I do not know the exact code for the situation I can only give you a basic idea of what it will look like.

First of you are checking if the users situation is either ACTIVE or NOTACTIVE, thus the conditiona; statement comes into play.

<?php
if($active == TRUE){
echo 'The image will be spit out here';
}else{
echo 'The not active image will go here';
}?>

Just find the exact code that deals with the profile fields and fill in where required. Ill dig through it later when I get back to my computer at home ( Im on my iPhone ).

*and quick note. You can do what I like to call blocking with HTML and do this...

<?php if($active == TRUE) { ?>
<img src="path here"/>
<?php } else { ?>
<img src="pathhere for the not active image"/>
<?php } ?>

This just allows you to put HTML freely between the tags as opposed to using an echo or print statement to render the image.

  • Administrators
Posted

Ok, I have added a new 'Profile Field' which is text. I have added this field to show up on pilots_list.tpl, on this list it will either say ACTIVE or INACTIVE. This looks too plain, and therefore I am asking if there is a code that would for example place an image on the pilots_list.tpl if ACTIVE is placed in that field insted of boring text.

Hey,

I think it's $pilot

So you can do

if($pilot->retired == 0)
{
   echo '<img src="/path to active image" alt="active" />';
}
else
{
  echo '<img src="/path to inactive image" alt="active" />';
}

With the variable for $pilot, you can get any column from the pilots table with:

$pilot->[column name]

  • Administrators
Posted

Good stuff, yep, you can just fuddle around with the code in there, if you see something you wanna change just go ahead and change it... remember the undo key ;)

Cheers!

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...