Hi,
I have a .txt file with data in the following way:
FRENEMY : a person with whom one is friendly despite a fundamental dislike or rivalry :
There seems to be a frenemy relationship between John and Andrew.
PORTMANTEAU : a word or morpheme whose form and meaning are derived from a blending of two or more distinct forms (as smog from smoke and fog) : Lewis Carroll's Jabberwocky is loaded with portmanteau words.
The following is my PHP:
<?php
//Check your text file exits
if (file_exists('interesting_words.txt')) {
//Retrieve content of text file
$content = file_get_contents('interesting_words.txt', true);
//Add every line of file to array
$lines = explode("\n", $content);
//Cycle through all line in file
$words = array();
foreach ($lines as $line) {
//Split word and description by :
list($word, $description, $example) = explode(':', $line);
//Create a words array to hold word and description
$words[] = array('word' => ucfirst(trim($word)), 'description' => ucfirst(trim($description)), 'example' => ucfirst(trim($example)));
}
//Generate random number from date
//Remove to generate random word every page load
srand(date("ymd"));
//Use random number from 0 to the cound of words array to pick word of the day
$word_of_the_day = $words[rand(0, (count($words) -1))];
//Use word, descriptionand example keys to print the results.
echo '<span id="word">'.$word_of_the_day['word'] . '</span>'.'<br>'.'<br>';
echo '<span id="description">'.$word_of_the_day['description'].'</span>'.'<br>'.'<br>';
echo '<span id="example">'.$word_of_the_day['example'].'</span>'.'<br>'.'<br>';
}
?>
I would like to have it displayed in the following way:
FRENEMY
a person with whom one is friendly despite a fundamental dislike or rivalry.
BUTTON
One would click the button to open a new popup window to show example sentences.
My problem is how do I go about coding for the window part.
All help appreciated.
Many thanks