JackPlumb Posted December 26, 2009 Report Share Posted December 26, 2009 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? Quote Link to comment Share on other sites More sharing options...
Kritikdevelopment Posted December 26, 2009 Report Share Posted December 26, 2009 Didn't read clearly. Sorry Quote Link to comment Share on other sites More sharing options...
JackPlumb Posted December 26, 2009 Author Report Share Posted December 26, 2009 All that staff do is go to the pilots profile on admin and add either Active or Inactive. So I am guessing it would be a code checking the text and replacing an image with it. Quote Link to comment Share on other sites More sharing options...
Kritikdevelopment Posted December 26, 2009 Report Share Posted December 26, 2009 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 Quote Link to comment Share on other sites More sharing options...
JackPlumb Posted December 26, 2009 Author Report Share Posted December 26, 2009 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. Quote Link to comment Share on other sites More sharing options...
Kritikdevelopment Posted December 26, 2009 Report Share Posted December 26, 2009 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. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted December 26, 2009 Administrators Report Share Posted December 26, 2009 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] Quote Link to comment Share on other sites More sharing options...
JackPlumb Posted December 26, 2009 Author Report Share Posted December 26, 2009 Cheers Nabeel, all I want to do is replace text that come from an extra column with an image. The text is either ACTIVE or INACTIVE. So is there a code that can replace this text? Quote Link to comment Share on other sites More sharing options...
JackPlumb Posted December 26, 2009 Author Report Share Posted December 26, 2009 It is working, THANKS! Happy New Year! Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted December 27, 2009 Administrators Report Share Posted December 27, 2009 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! Quote Link to comment Share on other sites More sharing options...
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.