StartVM Posted May 20, 2014 Report Posted May 20, 2014 Hello, I am coding a state of the art pilot center that includes custom data to each pilot. Lets say we have 3 different ranks: First Officer, Captain, Senior Captain And we have 3 trainers: John D, Jane D, John DA I am trying to make it so if your rank is First Officer, it will say your trainer is John D. If you rank is Captain your trainer is Jane D. I assume it would be an if statement like if rank= First Officer then show John Doe Obviously I don't know what I am talking about with the code, but I assume it is something like that. Can someone help me out? Thanks! Quote
StartVM Posted May 20, 2014 Author Report Posted May 20, 2014 Here is what I have styled and I will use the following tags. Rank: <?php echo Auth::$userinfo->rank;?> Next Rank: <?php echo $nextrank->rank?> So you can get the idea of what code I will need to display the following Quote
Members Vangelis Posted May 20, 2014 Members Report Posted May 20, 2014 Off topic starts First of all you will need to do plenty of if's like that Second what will happen when current chief pilot leaves your va for any reason. In my opinion the best solution would be a custom module connected with your database and assigning the trainer or manual to the pilot or automaticly /off topic end Here is your answer If(Auth::$userinfo->rank == "rank code" ) { Echo the name ; } ElseIf(Auth::$userinfo->rank == "rank code2" ) { Echo second name ; } And etc do not forget in order to avoid any errors Else { Echo "no trainer found" ; } Of topic lesson 1time the = might work but this means you are assigning data to a variable Twice the == means if something is like something Quote
StartVM Posted May 20, 2014 Author Report Posted May 20, 2014 This did not work. I got errors left and right when I tried it like this. http://pastebin.com/cW8egRkR Can you please create a pastebin to get me started. Here are the two ranks Regional First Officer (Rank ID= 1) (Echo Malachi Oie) Senior First Officer (Rank ID= 2) (Echo Bobby Mattox) Quote
Tom Posted May 20, 2014 Report Posted May 20, 2014 This did not work. I got errors left and right when I tried it like this. http://pastebin.com/cW8egRkR Can you please create a pastebin to get me started. Here are the two ranks Regional First Officer (Rank ID= 1) (Echo Malachi Oie) Senior First Officer (Rank ID= 2) (Echo Bobby Mattox) It'd be most useful for you to provide: 1. how you've adapted the code (rather than just putting the code given on pastebin) and 2. the errors you're getting Quote
StartVM Posted May 21, 2014 Author Report Posted May 21, 2014 1. http://pastebin.com/cBykf9fb 2. Parse error: syntax error, unexpected T_STRING in /home/redwoodv/public_html/vrd/lib/skins/vrd/profile_main.tpl on line 109 Quote
StartVM Posted May 21, 2014 Author Report Posted May 21, 2014 Off topic starts First of all you will need to do plenty of if's like that Second what will happen when current chief pilot leaves your va for any reason. In my opinion the best solution would be a custom module connected with your database and assigning the trainer or manual to the pilot or automaticly /off topic end Here is your answer If(Auth::$userinfo->rank == "rank code" ) { Echo the name ; } ElseIf(Auth::$userinfo->rank == "rank code2" ) { Echo second name ; } And etc do not forget in order to avoid any errors Else { Echo "no trainer found" ; } Of topic lesson 1time the = might work but this means you are assigning data to a variable Twice the == means if something is like something You mentioned what would happen if the current Chief Pilot left the VA? I am my own webmaster so in 30 seconds I can easily change 2-3 words in the code and have it fixed! Its is an easy change so paying $50 roughly for that type of module or even $10 would be unessesary Quote
StartVM Posted May 21, 2014 Author Report Posted May 21, 2014 I want to give a thanks to Ryan Herga from zumeweb.com for fixing up the code for us @ Redwood Virtual. Here is the fully functional code error free. http://pastebin.com/cVWwAARD 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.