douhuiqi3855 2014-01-31 19:08
浏览 224
已采纳

如何在OpenCart .tpl文件中获取当前URL?

I'd like to get the current url in a .tpl file in OpenCart.

I've seen this answer but it works only in a php file.

I have to get this way:

_my_array.push(['_productName',"<?php echo $heading_title; ?>"]);
**_my_array.push(['_productUrl', ["how can I get url ?"]]);**

Thanks

  • 写回答

2条回答 默认 最新

  • dongshu4755 2014-02-01 08:54
    关注

    To get full url

    <?php
    $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    ?>
    

    and btw those answers work on tpl files also because tpl files are sort of php files only

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?