Ben yüklenen HTML işaretleme ile bir DOM nesnesi var. Ben bu gibi bakmak tüm embed etiketleri değiştirmek için çalışıyorum:
<embed allowfullscreen="true" height="200" src="path/to/video/1.flv" width="320"></embed>
Böyle bir etiket ile:
<a
href="path/to/video/1.flv"
style="display:block;width:320px;height:200px;"
id="player">
</a>
Ben bu sergiyi sorun yaşıyorum ve ben bu düzenli ifadeyi kullanmak istemiyorum. Bana yardım edebilir?
EDIT:
Bu ben bugüne kadar ne var:
// DOM initialized above, not important
foreach ($dom->getElementsByTagName('embed') as $e) {
$path = $e->getAttribute('src');
$width = $e->getAttribute('width') . 'px';
$height = $e->getAttribute('height') . 'px';
$a = $dom->createElement('a', '');
$a->setAttribute('href', $path);
$a->setAttribute('style', "display:block;width:$width;height:$height;");
$a->setAttribute('id', 'player');
$dom->replaceChild($e, $a); // this line doesn't work
}