} appendToHtml("<div class='row'>"); //if it is an image jump to next for loop (assumng image has no Child) if ($subchild->getName() == "image") { appendToHtml('<img src="' . $subchild . '" alt="..." class="img-rounded">'); continue; } if ($subchild->children() != "") { appendToHtml('<span class="h4 text-danger "><strong>' . removeSpaceBetweenCapitalization($subchild->getName()) . "</strong></span>" . '</div>'); } if ($subchild->children() == "") { appendToHtml('<span class="h4 text-primary">' . removeSpaceBetweenCapitalization($subchild->getName()) . "</span>" . " : " . '<em>' . $subchild . '</em>' . '</div>'); } foreach ($subchild->children() as $subsubChil) { appendToHtml("<div class='row'>"); appendToHtml('<span class="h4 text-primary">' . removeSpaceBetweenCapitalization($subsubChil->getName()) . '</span>' . " : " . '<em>' . $subsubChil . '</em>' . '</div>'); //echo $subsubChil->getName() . ": " . $subsubChil . "; //appendToHtml("<\div>"); } } appendToHtml('<p> <button class="btn btn-large btn-primary" type="submit" value="' . $id . '" name="edit">edit</button> <button class="btn btn-large btn-danger" value="' . $id . '" type="submit" name="delete">delete button</button> </p>'); } appendToHtml("</form>"); $html = $html . '</div></div>'; $html = str_replace("{{contactData}}", $html, $htmlFile); // replaces placeholder with $username echo $html; function removeSpaceBetweenCapitalization($String)
$valueInNode = $dataIsInThisNode->childNodes->item($pos)->nodeValue; if ($nodeName == "id") { $id = $valueInNode; } if ($nodeName == "image") { appendToHtml('<div class="row>"><img src="' . $valueInNode . '" alt="..." class="img-rounded"></div>'); continue; } $childInCurrentNode = $dataIsInThisNode->childNodes->item($pos)->childNodes->length; if ($childInCurrentNode > 1) { appendToHtml('<div class="row"><span class="h4 text-danger "><strong>' . removeSpaceBetweenCapitalization($nodeName . '</strong></span></div>')); for ($posSubNode = 0; $posSubNode < $childInCurrentNode; $posSubNode++) { appendToHtml('<div class="row"><span class="h4 text-primary">' . removeSpaceBetweenCapitalization($dataIsInThisNode->childNodes->item($pos)->childNodes->item($posSubNode)->nodeName) . "</span> : " . $dataIsInThisNode->childNodes->item($pos)->childNodes->item($posSubNode)->nodeValue . "</div>"); } } else { appendToHtml('<div class="row"> <span class="h4 text-primary">' . removeSpaceBetweenCapitalization($nodeName) . "</span>" . " : " . '<em>' . $valueInNode . '</em>' . '</div>'); } } appendToHtml('<div class="row"> <p> <button class="btn btn-large btn-primary" type="submit" value="' . $id . '" name="edit">edit</button> <button class="btn btn-large btn-danger" value="' . $id . '" type="submit" name="delete">delete button</button> </p></div>'); } appendToHtml("</div>"); appendToHtml("</form>"); $html = str_replace("{{contactData}}", $html, $htmlFile); // replaces placeholder with $username echo $html; ?> <script> $( '#data' ).css('display', 'none');