332 Posts
Kenneth
7 years ago
Topic

Hi,

I'm struggeling to get field x to work in a list template. 

What I want to do is to grab only the first image placed in field x. I can do a print_r($cck) and see that the field indeed has the value I'm looking for, but I do not know how to get it with $item variable.

Anyone done this before and know the correct syntax?

Get a VIP membership
4229 Posts
Kadministrator
7 years ago
4
Level 1

332 Posts
Kenneth
7 years ago
3
Level 2

Hi, and thanks for the answer.

The guide you link to I have used before, and I have success when using a content view override. But I've never managed to make it work with a search & list view, with list template. I've created some own code in the list template, and would like to call this first image in the field x. 

Here I use $item->get instead of $cck->get (as the $cck do not work in the list template view)

I know I can use "advancced" and place the fields in the items tab instead, and with that create a override with minima template or something to get it working, but I would love to drop this step and just do it straight from list template. 

4229 Posts
Kadministrator
7 years ago
2
Level 3

Overriding list template is not possible at the moment, you can only create new template and place your code there.

332 Posts
Kenneth
7 years ago
1
Level 4

Yes, I understand. But what is the correct code/way to use field x in a list template, when not using advanced/item view? I can not get the $cck code to work, but have to use $item on list template code.

4229 Posts
Kadministrator
7 years ago
0
Level 5

For templates only available documentation is to look into existing ones and see what they use.

Get a VIP membership