' . $f["first_name"] . ' ' . $f["middle_name"] . ' ' . $f["last_name"]; if(isset($f["suffix"])) { echo ', ' . $f["suffix"]; } echo ''; } else { echo '

' . $overridename . ' ' . $f["suffix"] . '

'; } echo '
'; echo '
'; if (strpos($f["first_name"], ' ') !== false) { $lowerfirst = strtolower($f["first_name"]); $removemiddle = str_replace(' ', '-', str_replace('.', '-', $lowerfirst)); } else { $removemiddle = strtolower($f["first_name"]); } $imagePath = '/medicine/images/directory/' . $removemiddle . '-' . strtolower(str_replace(' ', '-', $f["last_name"])) . '-bio.jpg'; $defaultImagePath = '/medicine/images/directory/placeholder.jpg'; // Path to your default image // Check if the image exists if (file_exists($_SERVER['DOCUMENT_ROOT'] . $imagePath)) { $imgSrc = $imagePath; } else { $imgSrc = $defaultImagePath; } echo '' . $f['; echo '
'; echo '
'; // Add more fields as needed based on your requirements if ($faculty_title == "yes") { $title = $f["description"]; // Check if the department is "Women's and Children's Health" if ($f["department"] == "Women's and Children's Health") { // Check if the title contains the specific pattern if (preg_match('/Obstetrics\s(?:and|&)\sGynecology/i', $title)) { // Replace "and" with
, preserving "Obstetrics and Gynecology" $newTitle = preg_replace('/(Obstetrics\s(?:and|&)\sGynecology)\s+and\s+/i', '$1
', $title); echo '

' . $newTitle . '

'; } else { // For titles not matching the pattern, display as is $newTitle = preg_replace('/\band\b/i', '
', $title); echo '

' . $newTitle . '

'; } } // Check if the department is "Population Health & Social Medicine" elseif ($f["department"] == "Population Health & Social Medicine") { // Check if the title contains the specific pattern if (preg_match('/Population\sHealth\s(?:and|&)\sSocial\sMedicine/i', $title)) { // Replace "and" with
, preserving "Population Health and Social Medicine" $newTitle = preg_replace('/(Population\sHealth\s(?:and|&)\sSocial\sMedicine)\s+and\s+/i', '$1
', $title); echo '

' . $newTitle . '

'; } elseif (preg_match('/Associate\sLibrarian\s(?:and|&)\sSenior\sMedical\sLibrarian/i', $title)) { // Replace "and" with
, preserving "Population Health and Social Medicine" $newTitle = preg_replace('/(Associate\sLibrarian\s(?:and|&)\sSenior\sMedical\sLibrarian)\s+and\s+/i', '$1
', $title); echo '

' . $newTitle . '

'; } else { // For titles not matching the pattern, display as is echo '

' . $title . '

'; } } elseif ($f["department"] == "Clinical Neurosciences") { // Check if the title contains the specific pattern if (preg_match('/Physical\sMedicine\s(?:and|&)\sRehabilitation/i', $title)) { // Replace "and" with
, preserving "Population Health and Social Medicine" $newTitle = preg_replace('/(Physical\sMedicine\s(?:and|&)\sRehabilitation)\s+and\s+/i', '$1
', $title); echo '

' . $newTitle . '

'; } else { // For titles not matching the pattern, display as is $newTitle = preg_replace('/\band\b/i', '
', $title); echo '

' . $newTitle . '

'; } } elseif ($f["department"] == "Medicine" || $f["department"] == "Emergency Medicine") { // Split the title by variations of "and" and comma $titleParts = preg_split('/\s+and\s+|,\s*|,\s*and\s*|and\s+/i', $title); // Remove empty elements from the array $titleParts = array_filter($titleParts, 'strlen'); // Output the processed title with
tags echo '

' . implode('
', $titleParts) . '

'; } else { // For other departments, replace "and" with
as usual $newTitle = preg_replace('/\band\b/i', '
', $title); echo '

' . $newTitle . '

'; } } // Department Names and Associated URL $departments = array( array("department" => "Medicine", "url" => "/medicine/about/departments/medicine/"), array("department" => "Biomedical Science", "url" => "/medicine/about/departments/bio-med/"), array("department" => "Population Health & Social Medicine", "url" => "/medicine/about/departments/population-health/"), array("department" => "Surgery", "url" => "/medicine/about/departments/surgery/"), array("department" => "Women's and Children's Health", "url" => "/medicine/about/departments/women-children/"), array("department" => "Emergency Medicine", "url" => "/medicine/about/departments/emergency-med/"), array("department" => "Clinical Neurosciences", "url" => "/medicine/about/departments/neurosci/") ); if ($faculty_address == "yes") { echo '

' . $f["location"] . '

'; } if ($faculty_phone == "yes") { echo '

p: ' . $f["phone"] . '

'; } if ($faculty_email == "yes") { echo '

' . $f["email"] . '

'; } if ($faculty_dept == "yes") { // Iterate through the $departments array to find the appropriate URL $departmentUrl = ''; foreach ($departments as $dept) { if ($dept["department"] === $f["department"]) { $departmentUrl = $dept["url"]; break; // Stop the loop once the appropriate URL is found } } // Output the department name and associated URL echo '

Department: '; if (!empty($departmentUrl)) { echo '' . $f["department"] . ''; }else {echo $f["department"];} echo '

'; } echo '
'; echo '
'; } } ?>