ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Vector Media Group


You must be logged in to post.

Output all field data without knowing the field names



Is it possible to output all field data into a template without running through all cells?

Just using {catchall_field_name} would generate a table with all the field data

Rather than

The reason for the question; I am looking to use
SafeCracker, Catchall,  Matrix, MX Notify Control to generate custom forms; MX Notify Control generates emails upon entry to a channel, but if the client adds or removes form elements these must be manually added to the template.

# 1

There’s nothing in the field that will do that. Good idea though.

Reinoud en Jules
# 2
Reinoud en Jules

Any update on this?

I am trying to accomplish the exact same thing: Matrix + catchall to generate forms, but I also want to be able to output the form-entries dynamically without having to template them.

I’ve also looked into custom Queries, but no succes. To the developer: where can I find the data in the catchall field? All I can find is this “YTo3OntzOjg6IlZvb3JuYWFtIjtzOjg6IlZldXJuYWFtIjtzOj”-stuff. Is my data in there somewhere?

Thanks a lot in advance.

Reinoud en Jules
# 3
Reinoud en Jules

Alright, managed to pull it off. I’ll post it here so hopefully it’s to help for someone later on.

To output _all_ fields caught by the catchall-field, use this code:

{exp:channel:entries channel="your_channel_name"}

= @unserialize(base64_decode({field_id_X}));

$data as $table_header => $table_data{
= (strpos($table_header'_') === FALSE) ? $table_header str_replace('_'' '$table_header);
$cleaned_table_header = (strpos($table_header' ') === FALSE) ? $table_header str_replace(' ''_'$table_header);
is_array($table_data)) {
// this is the HTML that will be output in your template. The first echo is the name of the field, the second one is it's data.
echo("<b>" $cleaned_table_header ":</b> ");
$table_data "<br>");



Be sure to enable PHP for the template you use this in.

Note: the “field_id_X” is not your field name, but it’s your actual field_id_X, for example “field_id_26” or “field_id_4”. You can find this in your exp_channel_fields table in your database. Look for the fieldname you created as a channel field, look in it’s “field_id” column, add them together (so if the “field_id”-column says “26”, you get “field_id_26”).

I’m not sure why; but the code above doesn’t work with the actual field names.

I put this together using code from the field-type .php-file. Chris: I hope that’s ok with you?

Good luck!