dongxin9759 2015-04-15 10:26
浏览 47

如何在.tpl文件prestashop中使用php

I just integrated a web-marchant plugin on my prestashop website, and one of the requirement of the web marchant is that i show a message either error or success message after an order as been submitted.So from the url i can get the action if successful or not. And from what i have read from around here i need to change

this :

require_once(_PS_SMARTY_DIR_.'Smarty.class.php');

global $smarty;
$smarty = new Smarty();

to this:

require_once(_PS_SMARTY_DIR_.'SmartyBC.class.php');

global $smarty;
$smarty = new SmartyBC();

And this i already did,then i added this to the page i want to display the response i get from the $_GET[] variable.

{php}
/**
*@authour 
*@return Order response
*4/15/2015
**/
    echo urldecode(base64_decode($_GET['gtpay_error']));
    echo '<br>';
    echo urldecode(base64_decode($_GET['gtpay_tranid']));
{/php}

but still no luck,it output the code as it is.What might i be doing please. Thanks in advance

Now this is the php script am adding to the page:

{php}
        {$smarty.get.gtpay_error}
    {urldecode(base64_decode($smarty.get.gtpay_error))};
    {'<br>'}
    {urldecode(base64_decode($_GET['gtpay_tranid']))};
{/php}

then it throws error:

Parse error: syntax error, unexpected '=' in /home/thelibra/public_html/tools/smarty/SmartyBC.class.php(464) : eval()'d code on line 2
  • 写回答

2条回答 默认 最新

  • duanqiao3608 2015-04-15 10:30
    关注

    Try this :

    {$smarty.get.gtpay_error}
    

    $_GET is a reserved variable for Smarty, check this link for more information : http://www.smarty.net/docsv2/en/language.variables.smarty.tpl

    评论

报告相同问题?

悬赏问题

  • ¥15 python变量和列表之间的相互影响
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)