Example #1
0
        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)
{
    $Words = preg_replace('/(?<!\\ )[A-Z]/', ' $0', $String);
    return $Words;
}
//takes the global html value refering to contact id in Addcontatc.html and append new data to it
function appendToHtml($html1)
{
    global $html;
    $html = $html . $html1;
}
Example #2
0
                        } else {
                            exit("image error");
                        }
                    }
                } else {
                }
                break;
            default:
                break;
        }
    }
}
//check if shema is validate
if (!$xml->schemaValidate('contactListSchema.xsd')) {
    $value = libxml_display_errors();
    $dr = $value;
    appendToHtml('
    <div class="alert alert-danger alert-fixed-bottom" id="alertMsg">
  <strong>Warning !!!!</strong>' . $dr . '
<button onclick="hideAlert()">Make Modification</button>"</div>');
} else {
    //save the xml is validation o.k
    $xml->save("contactList.xml");
    appendToHtml('
    <div class="alert alert-success alert-fixed-bottom" id="alertMsg">
  <strong>Success!</strong>' . $dr . '
<button onclick="goToMainPage()">Go to main Page</button>"</div>');
}
$html = str_replace("{{alert}}", $html, $htmlFile);
// replaces placeholder with $username
echo $html;