Simple script to rotate text

@Gogol knows how to do this and has plenty of time to help you out for free, and maybe even create a nice layout on it for free too.
 
PHP:
<?php

$filename = 'messages.txt';

if (file_exists($filename)) {
    $messages = file($filename);
    echo trim($messages[rand(0, count($messages) - 1)]);
} else {
    echo 'Cannot find ' . $filename . PHP_EOL;
}
 
@Gogol knows how to do this and has plenty of time to help you out for free, and maybe even create a nice layout on it for free too.
Sure, I just uploaded this to github as I have so much time. :D
There u go OP..

Code:
https://github.com/noc2spam/show-random-text

Just clone it and it should work. You will need php to run this though.
 
Sure, I just uploaded this to github as I have so much time. :D
There u go OP..

Code:
https://github.com/noc2spam/show-random-text

Just clone it and it should work. You will need php to run this though.
Thank you for this
i pasted a long text and i want it to be as one full text but it split into lines so when checked via the index it show each line alone.
how to make all the long text and one text means one line
 
Thank you for this
i pasted a long text and i want it to be as one full text but it split into lines so when checked via the index it show each line alone.
how to make all the long text and one text means one line
Write a long line, then press enter. The script separates each line with \n (Enter button). Make sure you don't have any new line char inbetween the same line or it will also be split.


E.g. it could be:

Iam a longas line
Iam a very very very very very very very very very very very very very very very very very very very very very very long line
Short line
 
Last edited:
Hello
i searched many on google and found this php script
https://stackoverflow.com/questions/5857033/displaying-random-text/5857080
but it don't work
can any one help me with a simple script that i can put some text on txt file and randomly show text with each refresh?
maybe with nice layout with "copy" button so when the visitor click on that it copy the text
thank you
If you want to do that, you need to move the messages into a list and call a random function to grab a random message by index from the list.

This might help too.

https://github.com/ultros/spin-message
 
Back
Top