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

<var name="full_name" expr="'<?php echo

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
ejohnson
Posts: 5
Joined: Mon Jun 28, 2004 2:40 pm
Location: San Diego
Contact:

<var name="full_name" expr="'<?php echo

Post by ejohnson »

How come this code doesn't work? Yet every tutorial has is this way?

Thanks!

ej
Posts: 12
Joined: Fri Jun 18, 2004 7:54 pm

Post by ej »

:?: Uhhh... I dunno... seems to work fine on my system, meaning that the value of the PHP variable $full_name is interpolated into the string. The following HTML file should work when put on a web server (view source in browser). What were you expecting to happen?

-ej



<html>
<head><title>t7.php</title></head>
<body>
<hr>
<pre>

<?php

$full_name = "ej";

?>

<var name="full_name" expr="'<?php echo $full_name ?>'"/>

<pre>

</body>
</html>

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

more information needed to rectify IVR issue

Post by support »

ejohnson:

can you provide a little more information regarding what you are trying to do, what is failing, etc?

Your php is right, as ej correctly pointed out...can you post more IVR information so we can help you? :)


kind regards

Plum Support
Last edited by support on Wed Jan 06, 2010 2:34 pm, edited 1 time in total.

ejohnson
Posts: 5
Joined: Mon Jun 28, 2004 2:40 pm
Location: San Diego
Contact:

error msg

Post by ejohnson »

Thanks for your help!

This code:
<assign name="gReservationDateAndTime" expr="<?php echo $availableTimes[0] ?>" />

produces this error:
this file is not well formed. & expected

when I validate with XMLSPY.
****

With Plum Scratchpad validator it produces this error:
Fatal Error at line 44, char 53 Message: A '<' character cannot be used in attribute 'expr', except through <


Thanks a lot!
ejohnson

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

IVR error msg

Post by support »

Hi:

the reason you are getting the IVR error is probably because you arent wrapping the expr attribute contents with single quotes. Keep in mind that xpr evaluates to a <var> or to ECMA script.
eg:

Code: Select all

<var name="reservation_time_stamp" expr="'27449831'" />
<assign name="gReservationDateAndTime" expr="reservation_time_stamp" />
because the above IVR code does not wrap the expr attribute with quotes, it will evaluate the contents as ECMA. So gReservationDateAndTime will contain "27449831".

It can also be done this way:

Code: Select all

<assign name="gReservationDateAndTime" expr="'69253265'" />


since the above IVR code has an expr attrbute with single quotes it will evaluate the contents literally. This is often referred to as a "string literal", and is used in several programming languages .

It is recommended that you refer to the Plum IVR Programmers reference manual when encountering problems such as these. The Plum staff strives to maintain its accuracy and reflect the full set of functionality available to VXML developers using our IVR platform.
It is available here:
http://www.plumvoice.com/docs/dev/

Full information on several pertinent topics such as tag definitions, session variables , grammars, and application logging.

Hope this helps! :)

Plum Support
Last edited by support on Thu Feb 25, 2010 4:47 pm, edited 2 times in total.

ej
Posts: 12
Joined: Fri Jun 18, 2004 7:54 pm

Post by ej »

I have not used XMLSPY and I don't have much experience or expertise with VXML or even XML, but here's a second opinion to consider...

:shock: :idea:
It seems to me like the real issue is being missed here. I think you are trying to validate the wrong thing. If your VXML still has <?php ... ?> in it, then it hasn't been properly processed by the PHP interpreter. Are you trying to validate a PHP template? The whole idea of using PHP is to generate dynamic VXML, right? You want to XML-validate the output of a PHP script and so that script should be replacing all <?php ... ?> occurences with something that has meaning at the time your VXML is being generated, right?

:wink: -ej

Post Reply