Camen Design Forum

Delete

(Leave this as-is, it’s a trap!)

To delete this post you must be either the original author or a designated moderator.
The content of the post will be removed but the name and date will remain.

  • The post will be removed completely from the thread, rather than blanked
  • Only posts on the last page of the thread can be removed completely (so as to not break permalinks)

RE[19]: embedd youtube videos?

Martijn

@ms, sure, you could even repurpose my original script into something like:

%
/* Put this in theme.php, inside the `theme_custom` function. */
 
	foreach ($template->query('.nnf_reply-author, #nnf_post-author') as $node) {
		$value = '<img src="/avatar/' . md5(trim($node->nodeValue)) . '.png" alt="" /> '
		       . $node->nodeValue;
		$node->nodeValue = '';
		$frag = $node->ownerDocument->createDocumentFragment();
		if (!@$frag->appendXML($value) || !@$node->appendChild($frag)) {
			throw new Exception("Invalid HTML");
		}
	}
%

This should (untested) put an IMG infront of each name showing a PNG file in the avatars directory with an md5 hash of the user name as its filename. Someone with the name ‘ms’ would get `ee33e909372d935d190f4fcb2a92d542.png` infront of their name.

Note that you might want to put in a check `if` such a `file_exists` or you are going to get a lot of 404 hits against your server.

Haven’t had the time yet to get around to a DOMTemplate function for YouTube embedding. Soon, I hope.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn