Zum Inhalt springen

CWT Frontend Edit

Erstellt am 8. Juni 2004 · 8 Antworten · letzte Antwort am 27. März 2007

Tags: Frage

ffr_dev ·

hallo,
ich wollte die extension cwt frontend edit installieren/integrieren,
aber ich versteh die doku nicht ganz. :o

ich weiss einfach nicht, wo und was für code stücke ich einfügen muss. 😢

danke im voraus

Morden ·

Das war jetzt sehr präzise! 😉

Den Code schmeisste in ein Ext Tmpl, wo auch das Plugin drin sein soll.

Morden ·

ok...sorry...hab FE User Admin mit CWT verwechselt!

Benutzte das Frontend Edit mit der Community?

ffr_dev ·

nein, mit der cwt community hab ich nichts am hut.

eigentlich wollte ich eine extension schreiben, die die daten eines forms in die db speichert,
und diese extension macht genau das. 8-)

ja nun, weiter gehts...

tschüss

ffr_dev ·

das ist der ausschnitt aus der doku
http://typo3.org/documentation/document-library/cwt_feedit/Integration_of_the_e-1/

meine extension heisst form2db jetzt weiss ich nicht
kommen diese code schnipsel in mein pi1/class.tx_form2db_pi1.php
und wie muss ich diese anpassen??

1.2.1 Integration of the extension
 

To use the frontend edit extension, you have to integrate in your extension in a view steps:

Include the script in your extension:

include_once(PATH_typo3conf."ext/cwt_feedit/pi1/class.tx_cwtfeedit_pi1.php");

Now define which fields you want to edit, which helptext should be displayed and which error message should be displayed, in case of constraints that are not fulfilled.

$items = array();
$items["attribute_name_in_db"]["label"] = "The label";
$items["attribute_name_in_db"]["helptext"] = "The helptext";
$items["attribute_name_in_db"]["error_msg"] = "The error msg";


This example applies for the 'fe_users' attribute 'name':

$items["name"]["label"] = "Name:";
$items["name"]["helptext"] = "e.g. 'Sebastian'";
$items["name"]["error_msg"] = "Please enter your name.";

Furthermore you can define specific evaluation functions for a field. Possible values are:

twice:
The field will be displayed twice. This is especially usefull for password fields. Please refer to the "Examples" section for a working example.

atLeast:
This checks if the user typed in at least X characters. The syntax for "atLeast" ia as follows: "atLeast[X]".

atMost:
This checks for a maximum of allowed characters. The syntax is as follows: "atMost[X]".

email:
The field will be checked for a correct email address.

  $items["attribute_name_in_db"]["eval"] = "firstEval,secondEval,..";


Additionally you can define the type of the field. Possible values are:


preview
This means, that the fields value is displayed, but cannot be edited by the user.

password
This means, that the field is handled like a password field. So all characters are shown as asteriks ("*") in the edit and in the preview mode.

  $items["attribute_name_in_db"]["type"] = "password";


Now create the form object:

$table --> The table the attributes belong to.
$items --> The item you have just defined.
$record_uid --> The uid of the database record that should be edited.
$cruser_id --> The uid of the user, this record belongs to.
$back_id --> The id, the user will be sent back to, when he is finished.
$back_values --> The values, that are appended to the back url. e.g. Array("param" => "value")
$this --> You MUST put in '$this' here!!!!
$extending_ext --> In case you want to edit fields from extensions, that extend your target table. e.g. Array("my_ext_key")


$form = new tx_cwtfeedit_pi1($table, $items, $record_uid, $cruser_id, $back_id, $back_values, $this, $extending_ext);

Finally you get the html like this:

$content.= "<table>";
$content.= $form->getFormHeader();
$content.= $form->getElement("attribute_name_in_db");
$content.= $form->getElement("another_attribute_name_in_db");
$content.= $form->getFormFooter();
$content.= "</table>";


THAT's it! Nothing more to do.
Morden ·

also...

include_once(PATH_typo3conf."ext/cwt_feedit/pi1/class.tx_cwtfeedit_pi1.php");

schreibst du in den anfang DEINER Ext.

Den Rest aus machste dann in die entsprechenden functions rein.

claudia2 ·

ist zwar ein alter thread, aber passt. habe sonst keine hilfe gefunden...

okay, ich bin noch nicht so fit in php, kann mir jemand sagen wie und wo ich die Codeschnipsel in die class.tx_cwtfeedit_pi1.php einfügen muss??

im Prinzip möchte ich nur:
- verhindern, dass die User ihren Vor- und Nachnamen ändern können
- noch ein zwei Felder hinzufügen (Kommentare z.B.)

Woher zieht denn die cwt_feedit die bestehenden Felder die im Formular angezeigt werden???

Hat vielleicht jemand eine Beispiel php-Datei, die er mir zukommen lassen könnte?

das wäre natürlich erste Sahne...

schönen Abend!
claudia