Вот php файл
PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?PHP
- $htmlDoc = new DOMDocument('1.0', 'utf-8');
- $htmlDoc->preserveWhiteSpace = false;
- $htmlDoc->loadHTMLFile('ux.html');
- $root = $htmlDoc->createElement("div");
- $root->setAttribute("class", "forums");
- $root_child = $htmlDoc->createElement("div");
- $imgWrap = $htmlDoc->createElement("div");
- $img = $htmlDoc->createElement("img");
- $img->setAttribute("src", "../../images/forum/11971542601675001438kuba_Envelope_2.svg_.hi_-288x300.png");
- $titleWrap = $htmlDoc->createElement("div");
- $titleWrap->setAttribute("style", "width: 95.79081632653062%");
- $titleH3 = $htmlDoc->createElement("h3");
- $titleH3A = $htmlDoc->createElement("a", "Привет");
- $titleP = $htmlDoc->createElement("p", "ку");
- $titleH3->appendChild($titleH3A);
- $titleWrap->appendChild($titleH3);
- $titleWrap->appendChild($titleP);
- $imgWrap->appendChild($img);
- $root_child->appendChild($imgWrap);
- $root_child->appendChild($titleWrap);
- $root->appendChild($root_child);
- $forumHead = $htmlDoc->getElementById("A123456789");
- $forum = $htmlDoc->getElementById('scientists_them_wrap_1');
- $forum->insertBefore($root, $forumHead);
- $htmlDoc->saveHTMLFile('newUx.html');
- ?>