I would also advice against storing the HTML inside the database. It's much more convenient to store them as templates on the file-system and include them or parse them when needed. I also recommend using something like Smarty. A very handy tool, that is.
However, if you would rather do it manually, here is what I would do.
First, I would store the template in a file on the file-system. If you would rather use a database, that can be done to. Just know that a database will, usually, cause more overhead when used for stuff like this.
For example, in the case of a YouTube video:
<object width="{$width}" height="{$height}">
<param name="movie" value="http://www.youtube.com/{$path}"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/{$path}"
type="application/x-shockwave-flash"
allowscriptaccess="always"
allowfullscreen="true"
width="{$width}" height="{$width}">
</embed>
</object>
Then I would simply str_replace
the PHP variables in there, much like PHP itself does with strings.
<?php
$template_path = 'templates/youtube_vid.tpl';
$template_data = file_get_contents($template_path);
$old = array('{$width}', '{$height}', '{$path}');
$new = array(425, 344, 'v/zuZB2O6orV0&hl=en_US&fs=1&');
echo str_replace($old, $new, $template_data);
?>
And that would be it.
You could of course use <?php $width; ?>
-like placeholders and just include
the template, but that leaves you at risk for injection attacks. This is the safer route.