Author Topic: [TUT] Image Feld anlegen + Sortieren / Additional Image Field + Sorting  (Read 7113 times)

0 Members and 1 Guest are viewing this topic.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
-  Das Tutorial wurde von Ivan geschrieben. Ich möchte das Tutorial einmal etwas erweitern um auch zu erklären, wie es möglich ist weitere Felder zu ordnen.
- This tutorial was written by Ivan. I would like to extend the tutorial once more to explain how it is possible to arrange other fields.


-  Es gibt zwei Verschiedene Arten von Zusätzlichen Feldern
- There are two different types of additional fields

  • Images Fields / Bilder- Felder
  • User Fields / User Felder - Coming soon / kommt noch

-  In diesem Beispiel wird erklärt, wie ich ein zusätzliches Image Field anlegen kann. Das Text Feld ist einzeilig
und kann für verschiedene Eingaben wie z.b Photograph Copyright Hinweis eingesetzt werden.
- This example explains how I can create an additional image Field. The text box is one line
and for various inputs such as Photograph copyright notice may be used.

1) öffne / open includes/db_field_definitions.php
suche / search
?>

oberhalb einfügen / add above
$additional_image_fields['table_info_photo'] = array($lang['table_info_photo'], "tableinfo"0)
$additional_image_fields['image_photograph'] = array($lang['image_photograph'], "text"0)


2) öffne lang/***/main.php
suche / search
Code: [Select]
?>
oberhalb einfügen / add above
//-----------------------------------------------------
//--- Additional Fields -------------------------------
//-----------------------------------------------------
$lang['table_info_photo'] = "Photograph Infos";
$lang['image_photograph'] = "Photograph";

3) öffne / open templates/default/member_uploadform.html
füge in dem gewünschten Bereich dies hinzu / add in the desired range, this

Sprache / Language:
Code: [Select]
{lang_image_photograph}
Feld für die Eingabe: / Field for the input:
Code: [Select]
<input type="text" name="image_photograph" size="30" value="{image_photograph}" class="input" />
3a) öffne / open templates/default/details.html
füge in dem gewünschten Bereich dies hinzu / add in the desired range, this

Sprache / Language:
Code: [Select]
{lang_image_photograph}
Nur Anzeige / Show only
Code: [Select]
{image_photograph}
4) Gestaltung & Optionen / Design & Options
$additional_user_fields['image_photograph'] = array($lang['image_photograph'], "text", 0);

- Der rot markierte Text in diesem Fall "text" kann durch "textarea" oder "radio" oder durch  "tableinfo" ersetzt werden.
- The red highlighted text in this case "text" can be "textarea", or  "radio" or  "tableinfo" should be replaced

- Die grün makierte Zahl in diesem Fall 0 bestimmt ob das Feld ein Pflichtfeld sein soll oder nicht.
1 = Pflichtfeld
0 = Kein Pflichtfeld
- The green highlighted number 0 in this case is to be determined whether the field is a required field or not.
1 = required field
0 = Optional field

"text" Quelle: http://de.selfhtml.org/html/formulare/eingabe.htm#felder
- Einzeilige Eingabefelder dienen zur Aufnahme von einem oder wenigen Wörtern oder einer Zahl.
- One-line text boxes are used to hold one or a few words or a number

"textarea"
Quelle: http://de.selfhtml.org/html/formulare/eingabe.htm#bereiche
- Mehrzeilige Eingabefelder dienen zur Aufnahme von Kommentaren, Nachrichten usw.
- Multi-line text boxes are used to receive comments, messages, etc.

"radio" Quelle: http://de.selfhtml.org/html/formulare/auswahl.htm#radiobuttons
- Radio-Buttons sind eine Gruppe von beschrifteten Knöpfen, von denen der Anwender einen auswählen kann. Es kann immer nur einer der Radio-Buttons ausgewählt sein. Der Wert des ausgewählten Radio-Buttons wird beim Absenden des Formulars mit übertragen.
- Radio buttons are a group of labeled buttons, of which the user can select one. There can be only one of the radio buttons are selected. The value of the selected radio button is transmitted when sending the form with.

"tableinfo" Zusätzliche Felder abgrenzen / Additional fields delimit
- Mit "tableinfo" lassen sich Zusätzliche Felder abgrenzen beziehungsweise Kategorisieren
- With additional "tableinfo" can define additional fields or categorize

5)
- Damit die Funktion "tableinfo" auch funktioniert, muss diese erst dem System beigebracht werden
- Thus the "tableinfo" also works, it must first be taught the system

5a)
öffne / open admin/admin_functions.php
suche / search
function show_table_separator($title$colspan 2$anchor "") {
  global 
$bgcounter;
  echo 
"<tr class=\"tableseparator\">\n<td colspan=\"$colspan\"><a name=\"".$anchor."\"><b><span class=\"tableseparator\">".$title."</span></b></a></td>\n</tr>\n";
  
$bgcounter 0;
}

füge darunter / add after
function show_table_info_row($title$name$value 1) {
  global 
$HTTP_POST_VARS$lang;
  if (isset(
$HTTP_POST_VARS[$name])) {
    
$value $HTTP_POST_VARS[$name];
  }
  echo 
'
<tr class="tableseparator">
<td colspan="2"><a name=""><b><span class="tableseparator">'
.$title.'</span></b></a></td>

</tr>
'
;
}

suche / search
      case "radio":
        
show_radio_row($val[0], $field_name, ($value == "") ? $value);
        break;

füge darunter / add after
      case "tableinfo":
        
show_table_info_row($val[0], $field_name, ($value == "") ? $value);
        break;



6)
Datenbank Einträge
Code: [Select]
ALTER TABLE `4images_images` ADD `image_photograph` VARCHAR( 255 ) NOT NULL;
ALTER TABLE `4images_images` ADD `table_info_photo` VARCHAR( 255 ) NOT NULL;
Code: [Select]
ALTER TABLE `4images_images_temp` ADD `table_info_photo` VARCHAR( 255 ) NOT NULL;
ALTER TABLE `4images_images_temp` ADD `image_photograph` VARCHAR( 255 ) NOT NULL;
« Last Edit: November 12, 2013, 11:49:16 PM by Ben88b »

Offline kitty999

  • Newbie
  • *
  • Posts: 21
    • View Profile
First of all thank you for the tutorial.

Everything works fine but I was wondering how I could clean up the output?
For example: I have an additional field added to the upload form but when it's sent it adds <br /> after each line break. Ive noticed it does no do that with the 'image_description' variable so I'm just wondering where and how I would go about making my variable clean up like that.

Thank you very much for your time, I love the 4images script and have been working with it for a while, I even bought the bundle license