The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 3 of 3

Thread: blog tutorial, only displaying one entry

  1. #1

    blog tutorial, only displaying one entry

    Hi,
    I'm doing this
    http://www.webmonkey.com/webmonkey/0...tw=programming tutorial for a blog in flash and I'm stuck on part of it...the end. I already wrote about this tutorial in a previous thread but I have that part figured out. This is more about the actionscript part of it...or maybe it's the php. I'm not sure. I'm not sure what I'm doing wrong but I'm done with the tutorial and I only have one entry in my blog showing up online. I have 3 in my database. I'm wondering why I'm not seeing the archives for the others. My php is:


    <?php
    mysql_pconnect ("localhost", "username", "password");

    mysql_select_db ("blog");
    $qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC");

    $nRows = mysql_num_rows($qResult);
    $rString ="&n=".$nRows;


    for ($i=0; $i< $nRows; $i++){
    $row = mysql_fetch_array($qResult);
    $rString .="&id".$i."=".$row['id']."&"."&title".$i."=".$row['title']."&"."&date".$i."=".$row['date']."&"."&entry".$i."=".$row['entry']."&";
    }
    echo $rString."&";

    ?>


    My actionscript is:

    //function to load external data using the loadVars() object
    //l=name of loadVars object
    //n=name of text field
    //t=trigger to decide whether to show all entries or just one.
    //e= entry number to display (number)
    //f=file to load from (string)
    function lv(l, n, t, e, f) {
    sb.setSize(null, 200);
    sb2.setSize(null, 50);
    //create a new loadVars object if one doesn't already exist if it does, use it
    if (l == undefined) {
    l = new LoadVars();
    l.onLoad = function() {
    var i;
    //clear out any text that might already be there
    n.htmlText = "";
    //to show a single entry at a time we use the following code
    if (t == undefined) {
    n.htmlText += "<b>"+this["title"+e]+" - "+this["date"+e]+"</b><br><br>";
    n.htmlText += this["entry"+e];
    } else {
    //cycle through and show all entries
    for (i=0; i<this.n; i++) {
    n.txt.htmlText += "<u><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"+this["title"+i]+" - "+this["date"+i]+"</a></u><br>";
    }
    }
    sb.update();
    sb2.update();
    };
    }
    l.load(f);
    }

    function loadArc(passed) {
    arcNum = passed-1;
    lv(blog_lv, entries_txt, undefined, arcNum, "blog.php");
    }
    //for the large entry textfield
    lv(blog_lv, entries_txt, undefined, 0, "blog.php");
    //for the archives text field
    lv(archive_lv, archive_txt, "cycle", null, "blog.php");


    I found another post on kirupa about this tutorial but I didn't understand how they fixed the problem. I'd appreciate your help.

    Thank you.
    Holly

    Holly

  2. #2
    I think it might have something to do with this:

    I saw this in the tutorial but I don't know how to break it apart. I'd really appreciate any help.

    n.txt.htmlText += "<u><a href='asfunction:_root.loadArc,"+this["id"+i]+"'>"
    +this["title"+i]+" - "+this["date"+i]+"</a></u><br>";


    "Our href tag might look a little strange to veteran HTML coders. Flash has a little-known feature that allows you to call a function from within an HTML tag. The syntax is asfunction:location/nameOfFunction,variable. The limiting thing is that you can pass only one variable using this method.

    The quickest way around that problem is to pass a variable as long string and then break it apart in your function, but that won't be an issue for us since we have only one variable to pass."

    Holly

  3. #3
    Holly,
    Did you get this figured out. I'm having the same problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012