7 years ago
Topic

Hello there,

I need to get an array with  all fields name on a custom list template (using list view).

If I use before render field I would do this using this code:

foreach ($fields as $name) {
   $names[] = $name->name;
}

Is there a similar way to do this in template index.php with $items loop? Or maybe extracting it from $CCK?

My provisory solution is pass the array from before render field to index.php using a userstate variable.

I need this to create a javascript object to be used as filter on client side.

Thanks

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

You can use $cck->getFields

7 years ago
0
Level 2

Hello Klas,

I tried  $cck->getFields but it didn´t work. I opened rendering.php to  see the function and  I think It won´t work 

because of this line: " if ( isset( $this->positions[$position] ) )".

I am using list view without positions. Please correct me If I am wrong.

Thanks

4229 Posts
Kadministrator
7 years ago
1
Level 1

You can't have view without at least one position, fields are always assigned to a position.

7 years ago
0
Level 2

Now I got It!

All my fields were in hidden position!

Thanks Klas.

Get a Book for SEBLOD