VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: ketbel on March 31, 2020, 07:38:08 AM

Title: echo $viewData["payment_name"]; inside HTML code
Post by: ketbel on March 31, 2020, 07:38:08 AM
Hi,
I'm trying to rewrite this code

<div class="post_payment_order_number">
   <span class="post_payment_order_number_title"><?php echo vmText::_ ('COM_VIRTUEMART_ORDER_NUMBER'); ?> </span>
   <?php echo  $viewData["order_number"]; ?>
</div>

in to page orderdone.php. The code in this page is build up with HTML inside an PHP.

The first and second line is ok have I solved

echo '<div class="post_payment_payment_name">';
   echo '<span class="post_payment_payment_name_title">' .vmText::_ ('VMPAYMENT_STANDARD_PAYMENT_INFO').'</span>';

but how do I write this code:
<?php echo  $viewData['displayTotalInPaymentCurrency']; ?>.

I tried this:
echo $viewData["payment_name"];

and this

echo '<div>'$viewData['payment_name']'</div>';

Title: Re: echo $viewData["payment_name"]; inside HTML code
Post by: Jörgen on March 31, 2020, 08:05:15 AM
This is not VM support, this is PHP 101.

It is all about context

In PHP context:
echo $viewData["payment_name"];

In HTML context:
<?php echo $viewData["payment_name"]; ?>

There are plenty of tutorials out there, GOOGLE.

Jörgen @ Kreativ Fotografi