Customizing SMF > SMF Coding Discussion

GetElementbyTagName on subs-Post

(1/1)

Tjda:
Hi, i want to create one thumbnail for each topic, the creation of thumbnail is automatic, but i need get the elementes, like this:

--- Code: ---$DOM = new DOMDocument;
$DOM->loadHTML($str);
$items = $DOM->getElementsByTagName('object');
$videourl = $items->item(0)->getAttribute('data');

--- End code ---

my $str is equal  $msgOptions['body'], on sub-Post.php,
but the $msgOptions['body'] is like:

--- Code: ---[url=http://www.youtube.com/watch?v=1Y8QMdicJBg#]Dominik Eulberg - Sansula (Max Cooper Remix)[/url]
--- End code ---

i cant get the element! In the post, if i see the font code on browser, is like this:


--- Code: ---<article id="msg_43">
<table class="maeva" cellpadding="0" cellspacing="0" border="0" align="center" style="width: 550px; " id="sae1">
<tbody>
<tr>
<td style="width: 550px; height: 334px; " colspan="2" id="saeva1">
<object type="application/x-shockwave-flash" id="aevawi1" data="http://www.youtube.com/v/kJ4s3G7hgR4&rel=0&fs=1&showinfo=0" width="550" height="334">
<param name="wmode" value="transparent"/>
<param name="quality" value="high"/>
<param name="allowFullScreen" value="true"/>
<param name="allowScriptAccess" value="never"/>
<param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer"/>
<param name="autoplay" value="false"/>
<param name="autostart" value="false"/>
</object>
<script type="text/javascript">
1
2
3
4
5
<!-- // --><![CDATA[
var oldLoad = window.onload;
window.onload = function() { if (typeof(oldLoad) == "function") oldLoad(); aevacopy(); }
swfobject.embedSWF("http://www.youtube.com/v/kJ4s3G7hgR4&rel=0&fs=1&showinfo=0", "aevid1", "550", "334", "9", aeinst, {}, aevams, {id:"aevawi1"});
// ]]>
</script>
</td>
</tr>
<tr>
<td class="aeva_t">
<a href="http://www.youtube.com/watch?v=kJ4s3G7hgR4" target="_blank" class="aeva_link bbc_link new_win">Michael Kiwanuka - Home Again</a>
</td>
<td class="aeva_q" id="aqc1"/>
</tr>
</tbody>
</table>
</article>

--- End code ---

The question is, how i get the post like this last code, or, how i get the video url from the $msgOptions['body'] ?

Tjda:
grab url and works ...


--- Code: ---if(preg_match_all('~(http://www\.youtube\.com/watch\?v=[%&=#\w-]*)~',$message['body'],$m))
--- End code ---

Navigation

[0] Message Index

Go to full version