0

This is something I don't even think Drupal has built-in features for. I'm trying to theme taxonomy term page's nodes. The actual major problem is, I want to theme them per item. This for the actual HTML hierarchy (this is only a representation of the semantics I want, this is not to be interpreted as a visual representation):

+------ DIV ------+
|+----- DIV -----+|
||     node 1    ||
|+---------------+|
|+----- DIV -----+|
||     node 2    ||
|+---------------+|
+-----------------+

+------ DIV ------+
|+----- DIV -----+|
||     node 1    ||
|+---------------+|
|+----- DIV -----+|
||     node 1    ||
|+---------------+|
+-----------------+

+------ DIV ------+
|+----- DIV -----+|
||     node 1    ||
|+---------------+|
|+----- DIV -----+|
||     node 1    ||
|+---------------+|
+-----------------+

I really need this setup and can't be bothered with using complex CSS selectors (eg. :nth-child(odd)) this due to browser compatibility.

The only way I can imagine (and read on some places on the interwebs) is creating views as a workaround and theme that. But I would like not to make these excessive measurements just to workaround the lack of theming abilities of the taxonomy module.

Any thoughts? I thank you in advance!

2 Answers 2

0

This is the listing page for the taxonomy items, correct? the node page would be after you click on one of these to see the full content of that particular piece of content? And, if I understand correctly, you want a two column layout of this list? Here is a site I did recently that does that very thing.

http://noboribetsu-spa.jp/en/stay

This is very easy to accomplish. Just float left the class that wraps the item and all of them will fall into place. Let me know if I am not understanding what you are asking.

1
  • Thanks for your quick response blue928. I really need these HTML semantics, floating wont do the job. Sorry for being incomplete on which exact page I'm referring to, it's about the term pages.
    – Ambidex
    Jun 26, 2012 at 8:10
0

You could do this with Views grid style, set to two columns, then theme the template: views-view-grid--taxonomy-term--page.tpl.php to something like this...

<div class="<?php print $class; ?>"<?php print $attributes; ?>>
  <?php foreach ($rows as $row_number => $columns): ?>
    <div class="clearfix row <?php print $row_classes[$row_number]; ?>">
      <?php foreach ($columns as $column_number => $item): ?>
        <div class="col <?php print $column_classes[$row_number][$column_number]; ?>">
          <?php print $item; ?>
        </div>
      <?php endforeach; ?>
    </div>
  <?php endforeach; ?>
</div>

Then just float the cols:

.view-taxonomy-term .col {
  float: left;
  width: 50%;
}
1
  • I'm sorry, as mentioned above, in the comment I placed at blue928's answer, I need the semantics, not the columns. I'll edit my original post. The DIV visualisation might be a bit misleading.
    – Ambidex
    Jun 28, 2012 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.