views:

81

answers:

2

Say you have a WordPress theme you like, but want to make use of a bunch of Django code that's already written. Is there a good and easy, and performant way, of sucking in HTML that is output from Django and displaying it inline in a WordPress posting, or page without using browser frames? Any good examples of this?

+1  A: 

You can do this by outputting the content in Django as usuall and then making a Wordpress plugin with code for downloading it from Django's URL

readfile("http://yourdomain/your/django/view")

But it's a really bad idea. If you just want to use the wordpress theme port it to Django. This strange PHP/Python hybrid will be a nightmare to maintain, especially if at any point you decide to add more features or make it more dynamic.

Ludwik Trammer
Is it a bad idea from a performance standpoint, or only from a broad design philosophy standpoint? The problem is the WordPress theme is very complicated and feature rich, it's the 'Thesis' theme. I know of no easy way to port it to Django.
Leeks and Leaks
Both. If you know anything about programming in Django porting the "Thesis" theme shouldn't be a problem. HTML/CSS remains the same and the few part with content generated from database could be accomplished using inclusion tags.If you don't know Django (and you are not willing to learn) and the apps are not very complicated maybe you can port them to PHP?
Ludwik Trammer
I already know Django, at least a little bit. I think porting Thesis would not be a small job though, it would take quite a bit of time. I think your example could work for now though. I'm not sure how I would get that readfile() to be included as part of a WordPress posting though.
Leeks and Leaks
I'm not a Wordpress expert, but I see three options: 1. You can write a plugin; there is plenty documentation about that. 2. You can put the code inside the template (since Wordpress templates are PHP). Modify page.php to replace content on all pages, or create you custom page template (http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates) and choose which pages should use it in the admin. 3. Use Exec-PHP plugin to put PHP code right into you posts/pages.
Ludwik Trammer
+1  A: 

if the djanjo-code generates a rss-feed, you could use a plugin like wp-o-matic to import posts from your django website into wordpress.

futtta