PHP Classes

A Great Script!

Recommend this page to a friend!

      PHP Google Text to Speech  >  All threads  >  A Great Script!  >  (Un) Subscribe thread alerts  
Subject:A Great Script!
Summary:Can I keep it from starting on page load?
Messages:2
Author:Robert Lefebure
Date:2014-01-16 23:23:57
Update:2014-01-16 23:53:15
 

  1. A Great Script!   Reply   Report abuse  
Picture of Robert Lefebure Robert Lefebure - 2014-01-16 23:23:57
I would like to have multiple installations of the script on the same page but they all start on page load. Is there a way I can make them wait until their start buttons are clicked?

  2. Re: A Great Script!   Reply   Report abuse  
Picture of Mahmut Namli Mahmut Namli - 2014-01-16 23:53:15 - In reply to message 1 from Robert Lefebure
Firstly you need to save codes in Class' index.php as a separate file (example: sound.php),

Handle $_GET['lang'] and $_GET['word'] in your sound.php file and your text method will be like this:
$ttsObj->text($_GET['lang'], $_GET['word']);

Then you can use it on each of your examples like this:

<audio controls>
<source src="sound.php?lang=en&word=example" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

Don't forget to handle GET security issues.
You'll be done..