TennShadow Posted March 11, 2010 Report Posted March 11, 2010 Quick question. I had a staff member ask me if there was a way to only show their last name initial instead of their full last name? They didn't like the fact that where ever their name showed up it is their full name. Is this possible? I personally don't care one way or the other but I figured I'd ask. Thanks, Keith Quote
Administrators simpilot Posted March 11, 2010 Administrators Report Posted March 11, 2010 Sure is. Just do -> <?php echo $pilot->lastname[0]; ?> 1 Quote
TennShadow Posted March 11, 2010 Author Report Posted March 11, 2010 Sure is. Just do -> <?php echo $pilot->lastname[0]; ?> Awesome, thanks! Quote
TennShadow Posted May 30, 2010 Author Report Posted May 30, 2010 I never got this to work and I kind of forgot about it until now. Here is what the code is in two of the templates I would need to edit. In Pilot_List.tpl I have <?php echo $pilot->firstname.' '.$pilot->lastname?> In Pilot_Public_Porfile.tpl I have <?php echo $userinfo->firstname . ' ' . $userinfo->lastname?> How would I change that to not show the last name since it is not using the format above? Thanks... Quote
Administrators Nabeel Posted May 30, 2010 Administrators Report Posted May 30, 2010 Just add a [0] to the lastname, so: $userinfo->lastname[0] Basically a string is an array of characters, so by doing [0], you're telling it to only take the first element of the array Quote
TennShadow Posted May 30, 2010 Author Report Posted May 30, 2010 Just add a [0] to the lastname, so: $userinfo->lastname[0] Basically a string is an array of characters, so by doing [0], you're telling it to only take the first element of the array That worked! Thank you for your help! 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.