SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    England
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Latest Threads on Homepage

    I've been trying to display the latest threads from my forums on my homepage but can't get it to work right. It will display them but the links are not clickable.

    The code that I used was:

    <script src="/forums/external.php?type=js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    for (i in threads)
    {
    document.writeln(threads[i].title + " (" + threads[i].poster + ")<br />");
    }
    //-->
    </script>
    This is using the vB3 external thing.

    Anyone have any ideas?

    Thanks.

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:
    Code:
    <script src="/forums/external.php?type=js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    for (i in threads)
    {
    document.writeln("<a href=\"/forums/showthread.php?t=" + threads[i].threadid + "\">" . threads[i].title + "</a> (" + threads[i].poster + " )<br />" );
    }
    //-->
    </script>

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    England
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It gives me an error:

    Line: 166
    Char: 1
    Error: '[string].threads' is null or not an object
    Code: 0
    URL: http://mattsbabes.co.uk/

    Line 166 is document.writeln("<a href=""\"/forums/showthread.php?t=" + threads[i].threadid + "\">" . threads[i].title + "</a> (" + threads[i].poster + " )<br />" );

  4. #4
    SitePoint Zealot
    Join Date
    Feb 2001
    Location
    Utah
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here are a few examples for the external feed on my site:

    http://www.bikeforums.net/datafeed.html
    http://www.bikeforums.net/datafeed-black.html

    Hope that helps!

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    England
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code you use looks like what I have but yours works and mine don't.

  6. #6
    SitePoint Zealot
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry the code should be:
    Code:
    <script src="/forums/external.php?type=js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    for (i in threads)
    {
    document.writeln("<a href=\"/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a> (" + threads[i].poster + " )<br />" );
    }
    //-->
    </script>
    i'm confusing the + form JS and the . for PHP

  7. #7
    SitePoint Enthusiast
    Join Date
    May 2001
    Location
    England
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PC Freak, that works.

    Thanks.


Bookmarks

Posting Permissions

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