Custom node type teaser with Panels?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
fsa317's picture

Hi, I'm pretty new to Drupal/Panels so forgive me if this is a silly question. What I'm trying to do is display a list of "linked nodes". Using a panel I include the list of linked nodes and choose rendered node in my formatter. This appears to display the node's teaser. However I want to customize (pretty much completely) how that teaser looks - is that done via panels or someplace else? Or is there an entirely better way to accomplish the overall objective?

Comments

customize teasers

cpelham's picture

If you are using Views to generate your list of node teasers, then within that view's display, you could override the output of that teaser pretty much however you want. And if what you want to do is not achievable through the Views UI, then you could create a template file to override the markup/output of that particular views display.


Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
http://www.crsny.org

CRS (Center for Remembering & Sharing) is an arts & healing center located just south of Union Square in Manhattan.

So this can't be done via the

fsa317's picture

So this can't be done via the panels module? In my case this isn't shown via a view but I could try that. If I need to override a template how do I specify it for a teaser only?

override teaser template

cpelham's picture

For a view, I believe you could override the teaser with a template with the following name (replacing "viewname with the name of your particular view):

views-view-field--viewname--teaser.tpl.php

You can read the Views documentation for more details.

Panels for D7 does not currently have any UI of its own for formatting teasers. You can, of course, use CSS and/or javascript to format the output to a degree.

Other modules that can affect teaser output through a UI are the Contemplate module and the Display Suite module. You might look at them.


Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
http://www.crsny.org

CRS (Center for Remembering & Sharing) is an arts & healing center located just south of Union Square in Manhattan.

panels vs views etc

cpelham's picture

I can say that I, too, thought it would be intuitive and logical to place the UI for formatting output within Panels, which is creating output of html pages. Whereas Views is at heart creating structured output of data for all different kinds of purposes (html but also rss, etc).

Drupal might be much easier to use if all formatting instructions were added just before rendering. That is to say if we could better separate the UI's for 1) selecting/ordering the data and 2) rendering the data, that would be great IMHO.

So then the elements of Views that allow one to format the data could be cut out and instead could be appear in the UI for Panels, for Blocks, and for Nodes, etc.

As it is now, the formatting/rendering of the data can be affected by potentially so many different modules and different UI screens that it gets really crazy to keep up with what is affecting what where if one's site gets very big and complex.

But that's another discussion....


Christopher Pelham
Director
CRS (Center for Remembering & Sharing)
http://www.crsny.org

CRS (Center for Remembering & Sharing) is an arts & healing center located just south of Union Square in Manhattan.

Still can't get what I'm

fsa317's picture

Still can't get what I'm trying to do working. I'm able to add a mini panel to the teaser display, but the mini panel which needs to be php to run some custom code, can't see to get access of the node id of the node being teased. I've tried %node:nid and $node->nid neither work.

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: