Page 1 of 1

Dynamically change a directory name

Posted: Tue Apr 24, 2007 3:51 pm
by vmagic
Is it possible to dynamically change a directory name in <audio src=?

In the example below I would like to change the value of an expression like "$lang_dir" to equal the sub-directory name "english" or "spanish".

<audio src="http://incentivesonline.com/ivr/$lang_dir/welcome.mp3">
<!-- Play prompt in English or Spanish.
</audio>

dynamically change a directory name in IVR application

Posted: Tue May 01, 2007 10:14 am
by support
Hello,

Are you asking how to accomplish this IVR function using server side scripting, or within the document using ECMAScript? For server side scripting (using PHP) you would just use PHP's built-in variable functionality:

Code: Select all

<?php
$lang_dir = 'english';
?>
 <audio src="http://incentivesonline.com/ivr/<?php echo($lang_dir)?>/welcome.mp3"/>
In the case of ECMAScript you can store the value in a variable and use the srcexpr attribut of the <audio> tag to dynamically reference the audio file. This attribute allows you to contatenate strings to create the complete URL:

Code: Select all

<var name="lang_dir" value="'english'"/>
<audio srcexpr="'http://incentivesonline.com/ivr/'+lang_dir+'/welcome.mp3'"/>
Regards,
Plum Support