how to display the text for a particular duration of time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
samir_gambler
Forum Newbie
Posts: 19
Joined: Wed Mar 31, 2010 9:03 am

how to display the text for a particular duration of time

Post by samir_gambler »

Hello,
I am new to web development and I am trying to develop on-line exam practice website. I need to display a question for a particular duration of time and after that next question should be displayed and so on. Can any one please help me how to achieve this.

Thanks & Regards,
Samir
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: how to display the text for a particular duration of tim

Post by pbs »

first use AJAX and then using javascript setInterval() function you can change the question in some time interval
priyankagound
Forum Commoner
Posts: 27
Joined: Thu Sep 19, 2013 2:53 am

Re: how to display the text for a particular duration of tim

Post by priyankagound »

You will want to modify your WordPress theme so that the changes can be site-wide.

Log in to your WordPress installation.
Navigate to Appearance > Editor
In the Templates section, go to header.php
At the very beginning of header.php, insert your code :
<?php
$date = time();

$contestStart = strtotime('2012-02-03 00:00:00');

if ($date < $contestStart) {
?>

<html>
Insert your whole splash page here.
</html>

<?php
exit;
}
?>
//The normal template code should be below here.
Don't forget to click the "Update File" button on WordPress when you're done; and like the others said, make sure that your specified time is synced with whatever timezone the server is in.
priyankagound
Forum Commoner
Posts: 27
Joined: Thu Sep 19, 2013 2:53 am

Re: how to display the text for a particular duration of tim

Post by priyankagound »

Try out this.

if you need to display the link between 11:45pm and 11:59pm on Sunday, you could do something simpler:

For example:

if ($d == 'Sunday' && $h == 23 && $m >= 45 && $m <= 59) {
$ucrTimeToggle = 'radio-online';
} else {
$ucrTimeToggle = 'radio-offline';
}
Post Reply