A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: PHP text load

  1. #1
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118

    PHP text load

    code:

    NumLow = Number(NumLow)+Number(10);
    NumHigh = Number(NumHigh)+Number(10);
    GuestBook = "Loading Comments Numbered "+NumLow+" to "+NumHigh+" Please Hold";
    loadVariablesNum ("GuestBook.php?NumLow="+NumLow+"&NumHigh="+NumHig h+"&R="+random(999), 0);



    This is how the variables from the lower half of this
    code:

    <?php
    // If you are using an old version of php, remove the next set of lines.
    // or use $HTTP_POST_VARS["..."] instead.
    $Submit = $_POST["Submit"];
    $Name = $_POST["Name"];
    $Email = $_POST["Email"];
    $Website = $_POST["Website"];
    $Comments = $_POST["Comments"];
    $NumLow = $_REQUEST["NumLow"];
    $NumHigh = $_REQUEST["NumHigh"];

    // Replace special characters - you can remove the next 5 lines if wanted.
    $Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
    $Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
    $Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
    $Website = eregi_replace("http://", "", $Website);
    $Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

    // Remove slashes.
    $Name = stripslashes($Name);
    $Email = stripslashes($Email);
    $Website = stripslashes($Website);
    $Comments = stripslashes($Comments);

    // ################################################## #################################
    // ########## Reading and Writing the new data to the GuestBook Database #############

    if ($Submit == "Yes") {
    // Next line tells the script which Text file to open.
    $filename = "GuestBook.txt";

    // Opens up the file declared above for reading

    $fp = fopen( $filename,"r");
    $OldData = fread($fp, 80000);
    fclose( $fp );

    // Gets the current Date of when the entry was submitted
    $Today = (date ("l dS of F Y ( h:i:s A )",time()));

    // Puts the recently added data into html format that can be read into the Flash Movie.
    // You can change this up and add additional html formating to this area. For a complete listing of all html tags
    // you can use in flash - visit: http://www.macromedia.com/support/fl...s/htmltext.htm

    $Input = "<font color=\"#999999\">Name:</font><font color=\"#CCCCCC\"> $Name<br>\n<font color=\"#999999\">Comments:</font><font color=\"#CCCCCC\"> $Comments<br>\n<font color=\"#666666\">$Today<br><br>.:::.\n\n";


    /* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file. This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file */

    $New = "$Input$OldData";

    // Opens and writes the file.

    $fp = fopen( $filename,"w");
    if(!$fp) die("&GuestBook=cannot write $filename ......&");
    fwrite($fp, $New, 800000);
    fclose( $fp );
    }

    // ################################################## #################################
    // ######### Formatting and Printing the Data from the Guestbook to the Flash Movie ##



    // Next line tells the script which Text file to open.
    $filename = "GuestBook.txt";

    // Opens up the file declared above for reading

    $fp = fopen( $filename,"r");
    $Data = fread($fp, 800000);
    fclose( $fp );

    // Splits the Old data into an array anytime it finds the pattern .:::.
    $DataArray = split (".:::.", $Data);

    // Counts the Number of entries in the GuestBook
    $NumEntries = count($DataArray) - 1;

    print "&_root.lower.fcHolder.TotalEntries=$NumEntries&_r oot.lower.fcHolder.NumLow=$NumLow&_root.lower.fcHo lder.NumHigh=$NumHigh&_root.lower.fcHolder.GuestBo ok=";
    for ($n = $NumLow; $n < $NumHigh; $n++) {
    print $DataArray[$n];
    if (!$DataArray[$n]) {
    Print "<br><br>No More entries";
    exit;
    }
    }
    ?>



    is called

    Only thing is........

    it does not like

    autoSize = "center";

    Which I need in order to make this scroll with an ease.


    Any ideas?

  2. #2

  3. #3
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    what are you planning to use the autosize for? All versions of the guestbook I have seen just used a fixed size text field and the textfield.scroll and textfield.maxscroll properties

    Musicman

  4. #4
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    I was hoping to try to figure a way to have the text ease...

    and the autoSize="center" would make that possible


    is that not something that can be done

  5. #5

  6. #6
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    the only way I have used autosize was to make a textbox of fixed width as tall as required to hold all of the text - and it seems to be a good solution for a guestbook display.
    If this is not what you are looking for, maybe explain a bit more detail

    Would you mean "smooth scrolling" by ease, or is there something else?

    Musicman

  7. #7
    The G5 SP N_R_D's Avatar
    Join Date
    Apr 2004
    Posts
    1,118
    exactly....smooth scrolling...


    but for some reason the autosize is making the text not load....


    works fine with out it...




    dont know why.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center