Help with UDT

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
dinmix
Forum Members
Forum Members
Posts: 29
Joined: Sun May 06, 2007 2:49 pm

Help with UDT

Post by dinmix »

I'm trying to create a UDT for a form but I am stuck here. Appreciate if anyone can help. The original code are like the following:

Code: Select all

<input type=hidden name="cartId" value="echo'$Price['bookingid']; ">'
<input type=hidden name="name" value="<? echo $Price['fullname']; ?>">
I cant get this to work:

Code: Select all

echo'<input type=hidden name="name" value="<? echo $Price['fullname']; ?>"';
Also, I am not sure if I add echo infront of the script tag like the following in red.

Code: Select all

echo'<__script__ language="JavaScript" src="https://www.worldpay.com/cgenerator/cgenerator.php?instId=123456"></__script>';
Can anyone show me what is the correct way of doing this? Thank you
hasanen
Forum Members
Forum Members
Posts: 38
Joined: Tue Feb 15, 2011 8:44 am
Location: Helsinki, Finland

Re: Help with UDT

Post by hasanen »

I think it should be like:

Code: Select all

echo '<input type=hidden name="cartId" value="' . $Price['bookingid'] . '" />
<input type=hidden name="name" value="' .  $Price['fullname'] . '" />';
Although I prefer:

Code: Select all

echo sprintf('<input type=hidden name="cartId" value="%s" />
<input type=hidden name="name" value="%s" />',  $Price['bookingid'] , $Price['fullname']); 
If I remember right, you can't use "<?php" and "?>" tags in UDT. It's pure php. You could test your UDTs by making eg. form.php, write your code there and finally copy/paste the code to UDT (remberer to strip those "<?php" and "?>" tags).
Jos
Support Guru
Support Guru
Posts: 4017
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Help with UDT

Post by Jos »

Code: Select all

echo '<input type="hidden" name="name" value="' . $Price['fullname'] . '" />';
dinmix
Forum Members
Forum Members
Posts: 29
Joined: Sun May 06, 2007 2:49 pm

Re: Help with UDT

Post by dinmix »

Thank you guys, I will try that.
Post Reply

Return to “The Lounge”