Wordpress2drupal themes. Questions, Ideas and a broken presentation layer
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 :/
TheClue wrote:
Today i surprised myself thinking about how to use the HUGE themes base of WordPress blog platform in our beloved drupal.
[snip] The right way to do it is to probably make a new template engine altogether, so there'd be XTemplate, Smarty, PHPTemplate, and WordpressLoader. Then you'd not be messing with template.php overrides like you said.
Something like gutenberg for Movable Type. On Nov 14, 2007 2:55 PM, David Norman <davidn@cgraphics.com> wrote:
TheClue wrote:
Today i surprised myself thinking about how to use the HUGE themes base of WordPress blog platform in our beloved drupal.
[snip]
The right way to do it is to probably make a new template engine altogether, so there'd be XTemplate, Smarty, PHPTemplate, and WordpressLoader. Then you'd not be messing with template.php overrides like you said.
sounds really hard.... And i don't think is a good idea anyway. People would be a bit annoyed to have a new template engine to be installed. Since WP theme API is slighty simple, I cannot believe that PHPTemplate alone cannot handle it... gabrio Il giorno 14/nov/07, alle ore 20:55, David Norman ha scritto:
The right way to do it is to probably make a new template engine altogether, so there'd be XTemplate, Smarty, PHPTemplate, and WordpressLoader. Then you'd not be messing with template.php overrides like you said.
On 14 Nov 2007, at 10:13 PM, TheClue wrote:
And i don't think is a good idea anyway. People would be a bit annoyed to have a new template engine to be installed. Since WP theme API is slighty simple, I cannot believe that PHPTemplate alone cannot handle it...
it could. but you'd duplicate it for every single template. it's not the right place to implement it. Move all those api functions to a wordpress.engine, and just call the phptemplate functions from the wordpress.engine. it's really not hard.
participants (4)
-
adrian rossouw -
David Norman -
Jim Li -
TheClue