This question has been asked a few times. I have read every response but I never saw a cut and dry answer.

Is it possible to theme a zone? Of course, I know I can do this with CSS but I am wanting to actually restructure the content like I would do in a .tpl.php file.

For example, right now I am trying to word trim portions of a node's content that goes into a summary type box. Nodes of that same content type are also going in zones with more room so I don't want to trim the teaser as much or at all. If there was a way to specify a tpl.php file based on a zone, this would solve the issue.

Is this something I can do with Composite Layout? or would you recommend switching to Panels?

Thank you!

Comments

bengtan’s picture

> Is it possible to theme a zone?

If you mean whether it is possible to modify the HTML presentation of a zone by overriding a theme(...) call or a .tpl.php template file then ... No, this is presently not possible because there isn't a hook to allow external modules to interact though.

However, such a hook can be added into Composite Layout if needed. It should be relatively straightforward although I don't have any plans to do this since I'm not yet convinced how useful it will be. Feel free to try to convince me :)

Alternatively ... you can override the .tpl.php files for each layout ie. composite-layout-threecol-33-33-33.tpl.php and add your custom html in there for the zones of interest. It's a bit clunky but you might be able to achieve what you want this way.

interestingaftermath’s picture

Unfortunately, all I want to do is be able to word_trim the content of nodes places in certain Zones in the layout. The same content type will be placed in a large Zone with lots of room for the teaser as well as a smaller zone that only has room for a snippet of the content. It would be nice to do this in CSS but after some research, that's just not ideal for cross browser compatibility.

bengtan’s picture

Status: Active » Fixed

I've just committed a fix for an indirectly related issue (#719340: Display as 'Body only' ) which may help with this. Your themeing functions can now check which zone a node appears in (if there is one) by inspecting the $node->composite_zone variable (if it exists) and then operate accordingly.

However, I think you have also discarded your issue so I'm going to mark this as fixed. Please re-open if needed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.