Welcome, Guest
  • Author Topic: actionscript, xml and guestbook...  (Read 2328 times)

    caraffucciu

    • Server what's that
    • *
    • Posts: 34
      • View Profile
      • Email
    actionscript, xml and guestbook...
    « on: 07/18/06, 06:50 »
    hi,

    here, I use a guestbook for my site. My problem it is that I will like that it reads the last recorded message, then I have to modify in my code firstchild by lastChild... but it does not go nevertheless... can you explain me why and how to forward to my ends.
    thanks :)

    _______________________________________________________________________________________________________________________________________

    code actionscript:

    tabGuestbook = new Array();
    tabContenu = new Array();
    xml_doc=new XML;
    xml_doc.onLoad = traiteXML;
    xml_doc.load("readxml.php");
    stop ();



    /*----------------------------------------------------------------*/
    function traiteXML() {


    tabGuestbook=xml_doc.lastChild.childNodes;
    messCourant=0;
    _level0.gotoAndStop(5);
    }

    /*----------------------------------------------------------------*/
    function LireMessage(messNumero) {
    if (tabGuestbook[messNumero].nodeName.toLowerCase() == "message" ) {
          tabContenu=tabGuestbook[messNumero].childNodes;
    }
    for(j=0;j<tabContenu.length;j++) {
          type=tabContenu[j].nodeName.toLowerCase();
          if (type == "nom" ) {
          _level0.mess.messAuteur=tabContenu[j].lastChild.nodeValue;
          }
          if (type == "url" ) {
          _level0.mess.messURL=tabContenu[j].lastChild.nodeValue;
          }
          if (type == "email" ) {
          _level0.mess.messMail=tabContenu[j].lastChild.nodeValue;
          }
          if (type == "date" ) {
          _level0.mess.messDate=tabContenu[j].lastChild.nodeValue;
          }
          if (type == "texte" ) {
          _level0.mess.messTexte=tabContenu[j].lastChild.nodeValue;
          }
    }
    messNumber="::::  Message "+ (messCourant+1) +" sur "+ tabGuestbook.length + "  :::: ";
    }
    /*----------------------------------------------------------------*/

    function EcrireMessage() {


    }
    _____________________________________________________________________________________________________________________________________

    Code php "readxml.php":

    <?
    function readFileIntoBuffer( $filename )
    {
      @$fp = fopen( $filename, "r");
      if ( $fp )
      {
        $val = fread( $fp, filesize( $filename ));
        fclose( $fp );
        return $val;
      }
      return false;
    }
    $gbook=readFileIntoBuffer('guestbook.xml');
    header("Pragma: no-cache");
    header("Expires: 0");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, ");
    echo "$gbook";
    ?>



    caraffucciu

    • Server what's that
    • *
    • Posts: 34
      • View Profile
      • Email
    Re: actionscript, xml and guestbook...
    « Reply #1 on: 07/18/06, 13:58 »
    solved problem...

    while (messCourant<tabGuestbook.length-1) {
    messCourant+=1;
    LireMessage(messCourant);
    }

    it was not a problem of reading of node as I thought... but a problem with actionscript... I will have posted elsewhere thus the... sorry one