1283 Posts
Bucklash
8 years ago
Topic

Hi folks

In a nutshell: I want to show labels for my search results. 
(Question at the bottom)

Standard way is to activate the 'Item' view by either
  1. changing the List and Search Item view template from Seb List to Seb One
  2. changing Seb List's display from 'Standard' to 'Advanced'

  

However, I would like to show the labels in my 'Item' view.  

I have achieved this by adding conditionals to my custom List template. I also added conditionals so that if the field is a 'field_x' then it will only show the label once, rather than for each 'field_x' item, and only if 'field_x' has data to show.

if (($item->getLabel( $fieldname ) != 'clear') && (($item->getType( $fieldname ) != 'field_x' ) )) {
    $content   =  '<label class="label">'.$item->getLabel( $fieldname ).'</label>'.$content;
} 
if (($item->getLabel( $fieldname ) != 'clear') && (($item->getType( $fieldname ) == 'field_x' && $item->getTypo( $fieldname ) != '') )) {
    $content   =  '<label class="label">'.$item->getLabel( $fieldname ).'</label>'.$content;
}
QUESTION: Anybody out there have a better / preferred way to show labels in the 'Item' view, or is this THE way

Regards

Bucklash

Get a Book for SEBLOD
4229 Posts
Kadministrator
8 years ago
3
Level 1

If it works then there is no better way :) Joke aside - it seems ok

4229 Posts
Kadministrator
8 years ago
2
Level 2

Just one note - if you use item view you can override it by overriding item template, no need to do custom template (if you don't need that for other reasons)

1283 Posts
Bucklash
8 years ago
1
Level 3

Thanks klas

That's good enough for me. 

Bucklash

1283 Posts
Bucklash
8 years ago
0
Level 4

Sorry Klas,

Can you clarify what you mean by 

if you use item view you can override it by overriding item template

As far as I am aware I can 

  1. add fields to the Item view,
  2. alter the index.php of the template,
  3. override a position of a template....

Do you mean one of those three options?

Bucklash

Get a VIP membership