PDA

View Full Version : Question from neophyte



Diversions
09-23-2005, 12:43 PM
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

Twey
09-23-2005, 07:14 PM
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?

Diversions
09-23-2005, 07:29 PM
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

Twey
09-23-2005, 07:32 PM
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?

Diversions
09-24-2005, 01:05 PM
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.