42 Posts
Elric
7 years ago
Topic

Hello everybody and thank you for joinin me :)

I'm having some trouble trying to figure out how to call an image thumbs in a list  through a custom template...

As usual I adopt the tpl_basic_list by Jason (Thank you Jason!) as blueprint for my list templates, there it's noticed that fields should be called like

echo $item->get('field_name')->value;

as for thumbs I know that, once configured properly, it should be called like

echo $cck->getThumb1('field_name');
the problem is that I'm not able to combine the two things in harmony...

Can somebody give me an hint about that please?

Have a nice day!

Get a Book for SEBLOD
98 Posts
Edwin
7 years ago
1
Level 1

Hello romyo

I call my images like this in custom templates:

<img src="/<?php echo $item->get('user_avatar')->value; ?>" alt="<?php echo $item->get('user_name')->value; ?>" title="<?php echo $item->get('user_city')->value; ?>, <?php echo $item->get('user_country')->value; ?>" />

I do the same for content types and list/search types, substituting $item for $cck. Works for me. Let me know how it goes

42 Posts
Elric
7 years ago
0
Level 2

Hello Edwin!

Thank you for your suggestion, sadly this is not exactly what I need, I already can call my image fields, what I'm trying to do is to call the thumbnail  created by seblod from the uploaded image, as I've written before I use the syntax

echo $cck->getThumb1('field_name');
when in a content template, but in a list template I guess it's different!

98 Posts
Edwin
7 years ago
1
Level 1

Hello romyo

I hope I understand you correctly now. To call a specific thumbnail I use

echo $cck->get('field_name')->thumb1; 
if on content or echo $item->get('field_name')->thumb1; on list/search.


Remember the first thumbnail is always "0" (zero).

42 Posts
Elric
7 years ago
0
Level 2

On the spot! Thank you Edwin! Just what I was looking for :)

highfive!

Get a VIP membership