Advanced Search

Results 1 to 5 of 5

Thread: Question from neophyte

  1. #1
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default Question from neophyte

    I have just installed a simple blog program at www.a-diversion.com/blog and there is a table on the right for "other blogs" The php is ordering that the links be "shuffled" and I want the links to appear as I place them. Since the index.php file contains the php commands for that LINKS area, I suspect that it is the only thing I need to change but I am unsure as to the proper structure.
    Currently the php command for the link area is as follows (I tried dropping the shuffle part and messed it up)

    // LINKS SECTION

    if(file_exists("links.txt")) {
    $links = file("links.txt");
    }

    $num = count($links);

    if($num >= 1) {
    print("<BR><font size=2 face=verdana><B>
    <U>Other Blogs:</U><BR><BR>");

    srand((float)microtime()*1000000);
    shuffle($links);
    for($i=0; $i<count($links); $i++) {
    print("$links[$i]<BR>");
    }
    print("</font></B>");
    }



    print("

    Also, is there any way of writing the .txt file so I can create spaces between the entries on a selective basis?
    Can anyone point me in the right direction please? It would be greatly appreciated.

    Thanks

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You should just be able to remove shuffle($links); from the file. Do you want to post the file-writing code so I can adapt it?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    I will take out the shuffle($links); and see how it goes. I presume, professor the file-writing code means the entire code for the index.php? or am I looking for something else that you need to check for me.

    Thanks so much for your help

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Also, is there any way of writing the .txt file so I can create spaces between the entries on a selective basis?
    Do you mean when reading it? That depends. What would you like to select them by?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    Thanks Twey! I have played with the text file and have been able to accomplish what I needed. Everything is now sorted on the blog script.

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
  •