views:

19

answers:

1

I'm trying to think of a way to place Flash content into a blog post so that it appears inline between paragraphs. I'm writing a custom weblog application in Django (still learning) and I'll be using SWFObject for the embedding.

The blog is for me only so the back-end isn't too fancy. I'm simply using Django's built in admin interface. No TinyMCE rich text editor (like Wordpress), rather I've implemented Markdown.

I'd like to add Flash content into the body of a post, between paragraphs, in a way that is not coupled to any third party script. Meaning, I would prefer not to include javascript within the body of the blog post as it introduces a dependency on SWFObject. For example, I could quite easily add the following to an entry via the back-end to embed a SWF inline:

Paragraph one...

<script type="text/javascript">
swfobject.embedSWF("/path/to/flash.swf", "myContent", "200", "200", "9.0.0");
</script>
<div id="myContent"></div>

Paragraph two...

As you can see this is quite wordy and a lot to remember but it also refers to SWFObject directly. This WILL work, however I would prefer to write it in a "cleaner" more abstract way. What I was thinking of doing is creating my own parser which would translate a custom string into the above just before rendering a template.

[#SWF swf="/path/to/flash.swf" w="200" h="200" ver="9.0.0"]

I'm wondering if anyone has encountered this issue. I'd love to know how you solved it.

+1  A: 

You might want to look into OEmbed, specifically the django-oembed project.

Daniel Roseman