Hallo zusammen,
ich würde gern über ein Powermail-Formular Daten in der News Extension speichern.
Dafür gibt es auch in der Extension Anleitung eine gute Erklärung:
http://docs.typo3.org/typo3cms/extensions/powermail/1.6.11/Powermail/Features/SavingDbValuesToAnyDbTable/Index.html
Das habe ich dann so angepasst:
#Speichern in einer anderen Datenbank hier in News
plugin.tx_powermail.settings.setup {
# Save values to any table (example for tt_adress)
dbEntry {
#####################################################
### EXAMPLE for adding values to table tt_address ###
#####################################################
# Enable or disable db entry for table tt_address
tx_news_domain_model_news._enable = TEXT
tx_news_domain_model_news._enable.value = 1
# Write only if any field is not yet filled with current value (e.g. test if an email is already in database)
# default: always add new records (don't care about existing values)
# update: update record if there is an existing entry (e.g. if email is already there)
# none: no entry if field is filled (do nothing if record already exists)
#tt_address._ifUnique.email = update
# Fill new record of table "tt_address" with field "email" with a static value => mail@mail.com
#tt_address.email = TEXT
#tt_address.email.value = mail@mail.com
# Fill new record of table "tt_address" with field "pid" with the current pid (e.g. 12)
tx_news_domain_model_news.pid = TEXT
tx_news_domain_model_news.pid.data = TSFE:id
# Fill new record of table "tt_address" with field "tstamp" with the current time as timestamp (like 123456789)
tx_news_domain_model_news.datetime = TEXT
tx_news_domain_model_news.datetime.data = date:U
# Fill new record of table "tt_address" with field "address" with the current formatted time (like "Date: 20.01.2013")
tx_news_domain_model_news.crdate = TEXT
tx_news_domain_model_news.crdate.data = date:U
tx_news_domain_model_news.crdate.strftime = Date: %d.%m.%Y
# Fill new record of table "tt_address" with field "name" with the value from powermail {firstname}
tx_news_domain_model_news.title = TEXT
tx_news_domain_model_news.title.field = title
# Fill new record of table "tt_address" with field "name" with the value from powermail {firstname}
tx_news_domain_model_news.categories = TEXT
tx_news_domain_model_news.categories.field = categories
# Fill new record of table "tt_address" with field "last_name" with the value from powermail {lastname}
tx_news_domain_model_news.teaser = TEXT
tx_news_domain_model_news.teaser.field = teaser
# Fill new record of table "tt_address" with field "company" with the value from powermail {company}
tx_news_domain_model_news.bodytext = TEXT
tx_news_domain_model_news.bodytext.field = news
##############################################################
### EXAMPLE for adding values to table tt_address_group_mm ###
### Add relation to an existing address group with uid 123 ###
##############################################################
# Enable or disable db entry for table tt_address_group_mm
#tt_address_group_mm._enable = TEXT
#tt_address_group_mm._enable.value = 1
# Fill new record of table "tt_address_group_mm" with field "uid_local" with uid of tt_address record that was just created before with .field=uid_[tablename]
#tt_address_group_mm.uid_local = TEXT
#tt_address_group_mm.uid_local.field = uid_tt_address
# Fill new record of table "tt_address_group_mm" with field "uid_foreign" with uid 123
#tt_address_group_mm.uid_foreign = TEXT
#tt_address_group_mm.uid_foreign.value = 123
}
}
Damit funktioniert das speichern in der News Extension grundsätzlich schon mal.
INFO zum Thema Daten/Uhrzeiten:
In der Datenbank von der News Extension "tx_news_domain_model_news.bodytext" gibt es folgende Felder:
- tstamp (Datum der Änderung
- crdate (Datum der Erstellung)
- datetime (Datum & Uhrzeit mit dem man die News auch manuell erstellen kann.)
Mit folgenden Script kann man Kategorien von News im einem Selectionfield anzeigen lassen:
#Script: Wert aus anderer Datenbank in Powermail Formular anzeigen in einem Selectfield
lib.newsCategory = CONTENT
lib.newsCategory {
#Tabelle von wo der Wert kommt
table = sys_category
select {
#PID/Ordner dort wo die Tags gespeichert sind
pidInList = 19
andWhere {
value = 1=1
}
}
renderObj = TEXT
#Title ist der Name des Tags in der Tabelle
renderObj.field = title
#[\n] für die richtige Darstellung/Trennung der Werte
renderObj.wrap = |[\n]
}
Beispiel: Im powermail Formular wird nun in einem Selectionfield "Allgmein, Testberichte, Anderes" zur Auswahl gestellt.
Meine Unklarheiten: Wie kann ich nun diese zur Verfügung gestellten Werte (Kategorie) für meine Datensätze in oder für News speichern?
Dachte vielleicht so (weil es in der Tabelle ein Feld "categories" gibt):
tx_news_domain_model_news.categories = TEXT
tx_news_domain_model_news.categories.field = categories
Aber das klappt leider nicht. Jemand für mich einen Tipp?