Ankündigung

Einklappen
Keine Ankündigung bisher.

[Erledigt] GUI PM System

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [Erledigt] GUI PM System

    Hallo zusammen

    Ich habe ein Problem bei meiner Website. Ich wollte ein Privat Message System einbauen, welches einem Nachrichten zustellt. Der Code funktioniert auch. Nur das GUI nicht. Hier ist der GUI Code welcher stimmen muss, da ich den Code von einem Tutorial habe. Nur wird mir die Betreff Box, die Nachrichtenbox und der Sendknopf nicht angezeigt.

    An was kann das liegen?
    Gibt es eine andere Möglichkeit das GUI darzustellen?

    Vielen Dank für eure Hilfe
    Kebab

    Code:
    PHP-Code:
    if($isFriend == true && $isOwner == "no"){
        
    $pm_ui "<hr>";
        
    $pm_ui .= '<input id="pmsubject" onkeyup="statusMax(this,30)" placeholder="Subject of pm..."><br />';
        
    $pm_ui .= '<textarea id="pmtext" onkeyup="statusMax(this,250)" placeholder="Send '.$u.' a private message"></textarea>';
        
    $pm_ui .= '<button id="pmBtn" onclick="postPm(\''.$u.'\',\''.$log_username.'\',\'pmsubject\',\'pmtext\')">Send</button>';


  • #2
    Vielleicht keine Ausgabe von $pm_ui?
    Über 90% aller Gewaltverbrechen passieren innerhalb von 24 Stunden nach dem Konsum von Brot.

    Kommentar


    • #3
      Leider nicht....

      Hier ist der vollständige Code:
      Und unten ist die Ausgabe.
      PHP-Code:
      <?php
      // Protect this script from direct url access
      // You may further enhance this protection by checking for certain sessions and other means
      if ((!isset($isFriend)) || (!isset($isOwner))){
          exit;
      }
      // Initialize our ui
      $pm_ui "";
      // If visitor to profile is a friend and is not the owner can send you a pm
      // Build ui carry the profile id, vistor name, pm subject and comment to js
      if($isFriend == true && $isOwner == "no"){
          
      $pm_ui "<hr>";
          
      $pm_ui .= '<input id="pmsubject" onkeyup="statusMax(this,30)" placeholder="Subject of pm..."><br />';
          
      $pm_ui .= '<textarea id="pmtext" onkeyup="statusMax(this,250)" placeholder="Send '.$u.' a private message"></textarea>';
          
      $pm_ui .= '<button id="pmBtn" onclick="postPm(\''.$u.'\',\''.$log_username.'\',\'pmsubject\',\'pmtext\')">Send</button>';
      }
      ?>
      <script>
      function postPm(tuser,fuser,subject,ta){
          var data = _(ta).value;
          var data2 = _(subject).value;
          if(data == "" || data2 == ""){
              alert("Fill all fields");
              return false;
          }
          _("pmBtn").disabled = true;
          var ajax = ajaxObj("POST", "php_parsers/pm_system.php");
          ajax.onreadystatechange = function() {
              if(ajaxReturn(ajax) == true) {
                  if(ajax.responseText == "pm_sent"){
                      alert("Message has been sent.");
                      _("pmBtn").disabled = false;
                      _(ta).value = "";
                      _(subject).value = "";
                  } else {
                      alert(ajax.responseText);
                  }
              }
          }
          ajax.send("action=new_pm&fuser="+fuser+"&tuser="+tuser+"&data="+data+"&data2="+data2);
      }
      function statusMax(field, maxlimit) {
          if (field.value.length > maxlimit){
              alert(maxlimit+" maximum character limit reached");
              field.value = field.value.substring(0, maxlimit);
          }
      }
      </script>
      <div id="statusui">
        <?php echo $pm_ui?>
      </div>

      Kommentar


      • #4
        Danke

        Hey

        Deine Idee war zwar nicht richtig, aber hat mich zum nachdenken gebracht, wo ich überall Ausgaben habe. So merkte ich dank dir das ich vergessen hatte im Display Code die Datei einzubinden.

        Vielen Dank

        Kommentar


        • #5
          Verwende doch bitte eine Template-Engine wie Twig oder Smarty anstelle haufenweise HTML-Code mit String-Concenation zu erstellen.
          [URL="https://github.com/chrisandchris"]GitHub.com - ChrisAndChris[/URL] - [URL="https://github.com/chrisandchris/symfony-rowmapper"]RowMapper und QueryBuilder für MySQL-Datenbanken[/URL]

          Kommentar


          • #6
            Zitat von Kebab Beitrag anzeigen
            $pm_ui .= '<input id="pmsubject" onkeyup="statusMax(this,30)" placeholder="Subject of pm..."><br />';
            $pm_ui .= '<textarea id="pmtext" onkeyup="statusMax(this,250)" placeholder="Send '.$u.' a private message"></textarea>';
            Das placeholder-Attribut ist *kein* Ersatz für die Beschriftung der Eingabefelder!

            Kommentar

            Lädt...
            X