Layout of email send by information collector

Author Message

Marko Pohl

Tuesday 24 February 2004 3:54:20 am

Hi!
I am trying to format the email send by the information collector.
My aim is to have all fields in a custom order and layout.

I have started with overriding the template 'content/collectedinfomail/form.tpl' but I dont know how to access the submitted values by name.
All I found was the array $collection.attributes, but its indexed by numbers.

Thanks for any hints!

Paul Forsyth

Tuesday 24 February 2004 7:05:31 am

As the colleciton is a template like others you can use debugging like this:

{$collection.attributes|attribute(show)}

Your results should be in the email :)

From this you will be able to see the names of each attribute and code accordingly.

paul

Marko Pohl

Wednesday 25 February 2004 2:33:49 am

hi!

Maybe I explained myself not clear engough...
My problem is to access this array ($collection) by the attribute name.
The structure getting from |attribute(show) is an number indexed array:
>...
> data_text string 'tralla'
> contentclass_attribute_name string 'name'
>...
1
>...
> data_text string 'trallafdsds'
> contentclass_attribute_name string 'messege'
>...
...

In my temlate code I would like to access the fields this way:
{section show=$collection.attributes.message}
Message:
-----------------
{$collection.attributes.message.data_text|wash}
{/section}

Is this possible somehow?
Or, what is the template code to construct an string indexed array from the collection array?

Thanks for your answers,
Marko

Paul Forsyth

Wednesday 25 February 2004 4:57:16 am

You can access array elements just as you would with other programming languages. For example:

Show the name
{$collection.attributes[0].data_text|wash(xhtml)}

Show the message
{$collection.attributes[1].data_text|wash(xhtml)}

If you wanted to make it a little cleaner you could assign variables:

{let message=$collection.attributes[1]}
{$message.data_text|wash(xhtml)}
{/let}

The only problem with this is you must know what the index of the array refers to, which the attribute(show) has revealed.

Paul

Marko Pohl

Wednesday 25 February 2004 5:34:13 am

Hi!
First thanks for your replies!

>The only problem with this is you must know what the index of the array
>refers to, which the attribute(show) has revealed.

That is exactly my problem.
If you use checkboxes in a form they will only result in an new array item if they were checked. (Please correct me if I am wrong)
Otherwise the array will be shifted and all indexes after the checkbox will change.

My conclusion for now is to place all checkboxes at the end of the form class to keep the other indexes reliable. Not really nice...

Do you know how it is possible to construct an new array containing the 'data_text' values indexed by the 'contentclass_attribute_name' from '$collection'?

In future I will use


    

tags, looks cool :)

Marko

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.