Forum Moderators: coopster

Message Too Old, No Replies

Simple PHP Blogrolling Script

Just need to print 10 of 100 random text lines or X of Y text lines...

         

rollinj

10:39 am on Dec 8, 2006 (gmt 0)

10+ Year Member



You know in wordpress how you can create a simple "list" of your links? That will rotate the links randomly and only display 10 of 100 links or 40 or 100 if you so choose?

How could I emulate this via simple php script?

I just need to:
a) get text file (with html links seperated by new lines)
ex.
<a href="http://link1.com" title="Title etc...
<a href="http://link2.com" title="Title etc...
<a href="http://link3.com" title="Title etc...

b)Randomize the array and then print to produce:
Link1
Link3
Link2
or some other random order of links...

THANKS :)
-RollinJ

leadegroot

10:58 am on Dec 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



search for array_rand on php.net
Should do what you want :)

eelixduppy

11:52 am on Dec 8, 2006 (gmt 0)



Use file [us3.php.net] to get the links.

Then use shuffle [us3.php.net]; it may be a little easier to use in this case than array_rand [us3.php.net].

Good luck :)

rollinj

9:13 am on Dec 10, 2006 (gmt 0)

10+ Year Member



Thanks for your quick replies you two!

I'm just confused because there are a number of "random quote generators" available out there ready made in php... but none of them seem to output more than two quotes at a time :(

If anyone's willing to write up some text/code it would be GREATLY appreciated I can promse you that!

Thanks again!

coopster

1:45 pm on Dec 11, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld and the PHP Server Side Scripting Forum, rollinj.

eelixduppy has pointed you in the proper direction, all we ask here [webmasterworld.com] is that you first do a little legwork to try and get something working. If you encounter roadblocks, we are always here for you!