PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Include file containing sound if time is less than code

Go down

Include file containing sound if time is less than code Empty Include file containing sound if time is less than code

Post by jamied_uk 5th May 2016, 18:17

Include a sound if time matches desired time for example if more or less than 1 (so for new messages a sound can be heard)!

Code:

$convertedTime = '';

$when = '';

$timeAgoObject = new convertToAgo; // Create an object for ago

$convertedTime = ($timeAgoObject -> convert_datetime($postdate));

$when = ($timeAgoObject -> makeAgo($convertedTime));

$now = date('Y-m-d H:i:s');
if($when < '1'){

include 'chat_sound.php';

}



the sound file example:




Code:
<?php
$soundclip ="media/new_message.mp3";
?>
<audio id="sound" src="<?php echo $soundclip;?>" type="audio/mp3" autoplay="yes"></audio>
<div id="sound"></div>
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum