kamal
kamal

Reputation: 11

get variable smarty in php tag

We want to make date whmcs7 Gregorian dates change from the jalali That's why we put the following code in the file tpl smarty

{$invoice.datecreated}
{php}
    include_once ($_SERVER["DOCUMENT_ROOT"] ."/templates/six/jdf.php");
    $date = '{$invoice.datecreated}';
    list($g_y, $g_m, $g_d) = explode("/", $date);
    $str="/";
    print "(".gregorian_to_jalali ($g_y, $g_m, $g_d,$str).")";
{/php}

But this piece of code instead of putting on the variable The insertion string

$date = '{$invoice.datecreated}';
print $date;  // result: invoice.datecreated Instead 2015/01/31

please guide me

Upvotes: 1

Views: 110

Answers (1)

Hikmat Sijapati
Hikmat Sijapati

Reputation: 6994

I think you need double quotes.

$date = "{$invoice.datecreated}"; //double quotes here as "
print $date;

Example:

$name = "My name";

echo '{$name}';//outputs {$name}
echo "{$name}";//outputs My name

Upvotes: 1

Related Questions