[development] Wordpress2drupal themes. Questions, Ideas and a broken presentation layer

TheClue theclue at reloadmagazine.net
Wed Nov 14 19:41:03 UTC 2007


Hello to all! :-)

Today i surprised myself thinking about how to use the HUGE themes  
base of WordPress blog platform in our beloved drupal.

It's not trivial if u straight convert the CSS and you edit a bit the  
usual page.tpl.php, block.tpl.php and so, but it's not what i have in  
mind. My idea is to have the exactly same look of a wordpress site/ 
theme only replacing WP-API function calls (so that would be very  
easy to make a wrapper or a wp- engine around phptemplate?).

It means that, since i strickly won't change style.css that the html  
output of various pages MUST be exactly the same

A WP layout is more or less a reduced version of a drupal one  
(limited to two to three regions). For those unfamiliar with WP,  
newest themes already use the widget paradigm that is very similar to  
drupal's blocks.

But since the layout possibilities of WP are slighty limited,  
designers very often still hardcode something in theme pages (usually  
categories list, recent posts and 'meta' items). That's held the problem

(remember my needs: 1. same XHTML code 2. CSS unchangable 3. no need  
to make custom php blocks after installation)

1. I would edit box.tpl.php to provide the same html of a WP's  
widget, since it is a standard API output. I would override some  
themeable functions for the content (ie. theme_item_list) accordingly.

2. Because of the WP-theme engine realy limited, VERY VERY often WP  
designers hardcodes something in the page, usually "meta"  
informations, categories listing and recent blog posts. You can  
imagine that these hardcoded menus could have infinite HTML code.  
This means i cannot use a block model again (I already used it to  
make the "frame" of widgets).

Even because i want a smooth migration, i decided (for now) to  
hardcode too and i coded a bounce of phptemplate_wpsomething() in my  
template.php page to keep my .tpl.php pages clear.

*** THE PROBLEM ***

My template.php is full of overridden functions that are not part of  
presentation layer!

For example. To have a recent blog posts (very common in many WP  
themes) i had to override the blog module's hook function blog_block  
because it makes a call to node_title_list() (NOT themeable). And  
node_title_list() makes a call to theme_item_list that i ALREADY  
overriden to make code for the widget-blocks!

So since node_title_list is not themeable (and it wouldn't be wise to  
override even if it was) i had to copy-paste the entire hook function  
in template.php just to make the code for node_title_list inline and,  
finally, be able to change the call from theme_item_list to  
theme_somethingelse_item_list!

Results:

1. It breaks the presentation layer
2. It is a stupid mess
3. It is very annoying if u have to override lot of functions (WP API  
is limited but not so limited!)

Since I would like to think about an automatic way to convert themes  
from WP format to Drupal's, I prefer to resolve this issue before  
proceding. Any idea? :)

gabrio

PS sorry if my following questions will be stupid or full of grammar  
errors. I'm a newbie in development and my english is not so great :/



More information about the development mailing list