0

I got an event glossary at my site and the user needs to register for that events with powermail. I post the event title to the URL and then the title gets inserted into a input field at my powermail form. But now I need the date of the event, too.

This is my code so far:

        plugin.tt_news.mbl_newsevent{
  registrationLink_typolink {
    additionalParams.cObject = COA
  additionalParams.cObject {
    10 = TEXT
    10 {
     value = &tx_powermail_pi1[veranstaltung]={field:title}
     insertData = 1
    }
    20 = TEXT
    20 {
     value = {field:tx_mblnewsevent_from}
     insertData = 1
     stdWrap.date = d.m.Y
     stdWrap.outerWrap = &tx_powermail_pi1[datum]=|

    }
}

}

output is (URL): http://preview.eloum.de/anmeldung-infotag/?tx_powermail_pi1%5Bveranstaltung%5D=Infotag%20eBusiness-Lotse%20Oberschwaben-Ulm%2028.03.2014&tx_powermail_pi1%5Bdatum%5D=01.01.1970

why 01.01.1970? the timestamp is correct without that stdWrap.date = d.m.Y

EDIT: got it! My solutioN:

plugin.tt_news.mbl_newsevent{
  registrationLink_typolink {
    additionalParams.cObject = COA
  additionalParams.cObject {
    10 = TEXT
    10 {
     value = &tx_powermail_pi1[veranstaltung]={field:title}
     insertData = 1
    }



    20 = TEXT
    20 {

     field = tx_mblnewsevent_from
     insertData = 1
     date = d.m.Y
     wrap = &tx_powermail_pi1[datum]=|

    }
}

  }}
m1crdy
  • 1,371
  • 2
  • 25
  • 58

1 Answers1

1

Can you try

registrationLink_typolink {
  ...
  additionalParams= &tx_powermail_pi1[veranstaltung]={field:title}&tx_powermail_pi1[datum]={field:datetime}
  additionalParams.insertData = 1
}

... here's another try. I haven't tested it and I'll have to leave it there. So maybe you have to make some modifications. The general idea is that, as you can't say $date = makereadabledate($timestamp); and then use that in your template (as TS isn't a real programming language), you build the value you want to pass to additionalParams as a so called "cObject". In there, you can parse and wrap it. In the end, you would pass your string for further use to additionalParams. Hope you can make it work!

registrationLink_typolink {
  ...
  additionalParams.cObject = COA
  additionalParams.cObject {
    10 = TEXT
    10 {
     value = &tx_powermail_pi1[veranstaltung]={field:title}
     insertData = 1
    }

    20 = TEXT
    20 {
     value = {field.datetime} // or use "data"
     insertData = 1
     stdWrap.date = d.m.Y
     stdWrap.outerWrap = &tx_powermail_pi1[datum]=|
     // outerWrap: maybe not even necessary, the idea is not to interfere with the created string
     // cf. http://blog.bartlweb.net/2011/02/die-reihenfolge-der-wichtigsten-wraps-in-typo3/
    }
  }
}
Urs
  • 4,984
  • 7
  • 54
  • 116
  • You rock! Thank you! BUT: date is in linux timestamp. is it possible to convert this? – m1crdy Mar 17 '14 at 09:35
  • 1
    Try this hacky approach: http://lists.typo3.org/pipermail/typo3-german/2007-September/038917.html - it is possible to convert the date, but AFAIK, TypoScript doesn't provide an easy way to insert an Object into a dataWrap (like a variable), so that's why they make the workaround with all these wraps – Urs Mar 17 '14 at 09:50
  • Ty! I´m not that good with typoscript. this is my code now, but i´m not sure of that url insertion: I have updated the code in my question! (see #???#) – m1crdy Mar 17 '14 at 10:40
  • Sorry, that was confusing. I didn't look a the link good enough. – Urs Mar 17 '14 at 10:59
  • Thx! That´s the URL now: index.php? id=62&tx_powermail_pi1%5Bveranstaltung%5D=Infotag%20bei%20der%20Kreishandwerkerschaft%20Aalen%2002.04.2014 It´s without the marker "&tx_powermail_pi1[datum]" one last hint ;) – m1crdy Mar 17 '14 at 12:10
  • 1
    Nice. So the outerWrap is not catching. Maybe simply because I forgot `20=TEXT`above? Else, you coud try other types of wraps, like regular `wrap`, or insert a COA item in between 10 and 20 to add that string where it's supposed to go: `15 = TEXT`, then `15.value = &tx_powermail_pi1[datum]=`. Lego-like. – Urs Mar 17 '14 at 14:05
  • Damn... so close. I edited the question... Ty for helping me! – m1crdy Mar 18 '14 at 10:10