332 Posts
Kenneth
7 years ago
Topic

Hi. I've setup a content type,which loads some relevant content with the list field.

Basically, I check the cat_id of the content, and show a list of items from another content type having the same ID. This works.

What I can't figure out is how to get to these variables to do a if!empty check (I want to show some content when there in fact is some articles to fetch, not otherwise). 

I've done a print_r on $cck, but for the list field the items that are fetched is rendered as normal. 

So I would like to know if I can do something like this

$cck->get('list_field')->value[0] or something, to check if there really is a first item in this list field

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

You can't do this from parent, you would need to do such check in child list type e.g. in beforeRender event.

332 Posts
Kenneth
7 years ago
0
Level 2

Thanks. Also, I figured out that if there are no results the template isn't loaded at all. So I just placed ordinary html on top of it to solve it. 

Get a VIP membership