[typo] HTML structure

Piers Cawley pdcawley at bofh.org.uk
Fri Apr 14 10:59:06 EDT 2006


Gary Shewan <gpsnospam at gmail.com> writes:
> On 14 Apr 2006, at 07:05, Piers Cawley wrote:
>
>>   * No more overriding layouts/default.rhtml just to add a couple of
>>     theme specific css files. We've already moved to having most of
>>     the layout's header generated by a helper method, it should not be
>>     beyond our wit to have it do something like:
>>     <%= render :partial => 'common/stylesheets.rhtml' %>
>>
>>     as part of its strategy.
>>
>>   * Nail down the basic semantic structure of our layout and have  
>> more of the
>>     individual divs rendered as partials (and hence more finely
>>     overrideable by a theme). Also, the 'partial' boundary might well
>>     be a good place to insert more granular fragment caching for
>>     better performance.
>>
>>   * Make use of the hAtom microformat (and possibly other microformats
>>     for other bits and pieces, is there one for tag clouds yet?)
>>
>>   * Get some feedback from (or become) CSS experts with an eye to
>>     designing a basic page structure that's flexible enough that most
>>     themes can simply provide a css file and a bunch of images. Check
>>     out the CSS Zen Garden for the sort of thing that has been
>>     achieved with 'pure' CSS.
>>
>>   * As we're breaking themes already, let's break 'em good and proper
>>     so we can rebuild them stronger, better, faster...
>>
>> Thoughts?
>
> I don't understand what you're getting at here ... at all.  And I've  
> tried.

Bah! You obviously haven't tried hard enough!

> Breaking themes has nothing to do with CSS.  Rendering a sidebar has  
> nothing to do with CSS, rendering the content has nothing to do with  
> CSS.  I could put my CSS on a wordpress install and it would look the  
> same (after renaming my divs).  That's the whole point of CSS - it's  
> just the styling.
>
> My theme was broken because I had to change
>
> <%= render_component(:controller => ‘sidebars/sidebar’,
> :action => ‘display_plugins’ %>
>
> to
>
> <%= render_sidebars %>
>
> in default.rhtml and that has nothing to do with how pretty my site  
> looks (CSS) but how the sidebar is rendered (Typo code).
>
> Separate CSS and HTML in your mind.

Pointy end grandma.

> Why would you want to stop a themes overriding default.rhtml (if  
> that's what you mean)?  As that's a nice feature.

I want to stop every theme and its brother *having* to override
default.rhtml. It's a 'nice' feature, but we're definitely cracking
nuts with sledgehammers if we end up overriding default.rhtml just
because we want to change a stylesheet.

If we have a default (rails) layout that goes something like:

  <!DOCTYPE html Blah Blah>
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <%= render :partial => 'common/html_head' %>
    </head>
    <body id="<%= params[:controller].gsub('/', '-') %>">
      <div id="header">
        <%= render :partial => 'common/header' %>
      </div>
      <div id= "page">
        <div id="content">
          <%= yield %>
        </div>
        <div id="sidebar">
          <%= render :partial => 'common/sidebar' %>
        </div>
        <br style="clear:both;" />
      </div>
    </div>
    <div id="footer">
      <%= render :partial => 'common/footer' %>
    </div>
  </html>

And make the various 'common/*' partials overrideable by the theme,
then we're already in the position that a theme designer can alter the
structure of the various divs without having to repeat a bunch of
boilerplate. 

> Why are you talking about nailing down a basic structure of the  
> layout?  That's for a theme designer to do surely?

No, I'm talking about nailing down the basic structure of the HTML we
generate. Layout is done with CSS. The problem here is that the Rails
concept of a layout clashes with the CSS concept of a layout. It's
awfully easy to get the two confused (and my original post wasn't a
model of clarity in this respect, for which I apologise).

Take a look at the sort of thing that's achievable using nothing but
CSS styling over at the CSS Zen Garden. My goal here is to have our
default theme consist of nothing more than a couple or three
stylesheets and have our basic, unthemed output be structurally sound
enough that the majority of themes can do the same. At the very least
we need to make sure that our unthemed output (including the core
sidebars, which means I need to take a look at the Amazon contoller)
is fully compliant with XHTML Strict. 

> I'm lost.
>
> Is it just me?  Could be ;)
>
> I readily agree that something needs to be firmed out though because  
> I'd put money on the fact that nearly every theme in the contest  
> would be broken in trunk now.

Well, if it uses sidebars, it's broken. And if it wants to use at
least one of the plugins (can't remember which one) that needs a
particular javascript included in the header, it's doubly broken.

-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/



More information about the Typo-list mailing list