Hi fago,
thx for this great module. I use it for a literature-content-type. I have books, newspapers and online-sources as node-types and use field-collections to add pagenumbers etc. to a specific dataset. So there is only one node called "Financial Times" an many nodes that refer to the "Financials Times"-node adding pagenumbers and issue-information in the field-collection to a research-article. Works fine!

I'm having trouble to theme the different field-collections depending on node-type (newspaper/book/online) and thought, i could accomplish this with a node--field-collection-fieldcollectionname.tpl.php template, because when viewing the collection the url is as follows: ".../field-collection/field-internetcollect/41" ?.
Am i missing something?

Thanks for this wonderful module.
bombo

Comments

joeysantiago’s picture

i'm looking for this too :)

actually, i found out i can use field--field_name.tpl.php... i wonder: is there a field--field_name--collection_name.tpl.php?

looks like i found it.

my field in my collection is called "field_song_lyrics" the collection is called "field_song" and the tpl i found out is called is "field--field_song_lyrics--field_song.tpl.php". it should work.

thanks for the great module

tim.plunkett’s picture

@bombo, do you mean field-collection-item--NODE-TYPE.tpl.php? What you're viewing at /field-collection/field-internetcollect/41 is not a node, nor a field collection, but the field collection item.

@joeysantiago, field--field_song_lyrics--field_song.tpl.php should indeed work.

RobW’s picture

Oh, very cool. Thanks joey and tim, that is a functioning workaround for #1137024: Field--your-field-collection.tpl.php cascades and overrides all collected field's tpls.

joeysantiago’s picture

found out quite a cool thing:

in order to know the exact file names drupal looks for when loading a page, add:

dpm(theme_get_suggestions(arg(), 'page'));

to your themename_preprocess_page(&$vars, $hook) function. then, substitute "__" with "--" and you're done with your template filename.

hope it helps.

RobW’s picture

Status: Active » Closed (duplicate)

Marking this as a duplicate of #1157794: Move markup to template files and improve theming in new 2.x branch. There's plenty of theming goodness there that should cover all of the OP's needs.