[development] Drupal 5 Themer Pack

Bèr Kessels ber at webschuur.com
Mon Jan 22 13:52:24 UTC 2007


Hello,

You mention one thing that cannot be dealt with in a contributed theme: the 
almost-random string concanation done by core functions. 
Another very nasty one is how cascade theme-ed content.

Op maandag 22 januari 2007 13:38, schreef jason at jayro.net:
> There's more in that file. Including mark up violates MVC separation IMHO.
>
> Actually, I thought this is exactly where Earls' project suggestion is  
> suppose to lead us to (clean MVC). Someone please correct me!

We see these two concepts in core (deliberately left simple, for more 
confusing/real-world examples hunt for Foreaches, Ifs and Whiles inside theme 
functions): 

...
return theme('foo', $data);
...
theme_foo($data) {
  $out = '<div id="foo-wrapper">';
  $out .= theme('bar', $data['items']);
  $out .= '</div>';
}
--------------
...
$part = teme_item_list();
$part .= theme('foo', $data, $part);
return $part;
...
theme_foo($data, $list) {
  $out = '<div id="foo-wrapper">';
  $out .= $list;
  $out .= '</div>';
}

Or, in words: do you call a theme function from within a theme function? Or do 
you build strings, then pass these chunks-of-HTML along to the next theme 
function? I -personally- always prefer the first option: that way your theme 
has much more power, which comes with added complexity.

This project of Earl would probably need to agree on one of both as 'preferred 
standard'. Currently the random use of one of these two in Drupal (and 
contribs) is utterly confusing, and IMO the main cause for the inconsistency 
in the outputted XHTML. 

Bèr
-- 
Drupal, Ruby on Rails and Joomla! development: webschuur.com | Drupal hosting: 
www.sympal.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20070122/6b26ab4d/attachment.pgp 


More information about the development mailing list