We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Dynamically change a directory name

Questions and answers about Plum iOn systems

Moderators: admin, support

Post Reply
vmagic
Posts: 14
Joined: Tue Aug 08, 2006 3:20 pm

Dynamically change a directory name

Post 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>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

dynamically change a directory name in IVR application

Post 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

Post Reply