简体   繁体   English

使用prestashop 1.7在smarty模板文件中生成友好的url链接

[英]generate friendly url link in a smarty template file with prestashop 1.7

using latest prestashop from git. 使用来自git的最新prestashop。

I'm trying to create a link to a page I created under the design -> Pages tab of the admin panel. 我正在尝试创建指向在管理面板的“ design ->“ Pages标签下创建的页面的链接。

I can browse link by going to http://prestashop.ufk:8080/he/content/6-test-1 我可以通过转到http://prestashop.ufk:8080 / he / content / 6-test-1浏览链接

the id of the page is 6 and the friendly url I chose is test-1 . 该页面的ID为6 ,我选择的友好网址为test-1

how do I convert this to a {url} smarty link ? 如何将其转换为{url}智能链接?

thank you 谢谢

Use {$link->getCMSLink('6')} . 使用{$link->getCMSLink('6')} If you get undefined variable error (can happen in your module templates) then you need to define $link before loading your template. 如果出现未定义的变量错误(可能在模块模板中发生),则需要在加载模板之前定义$link

$this->context->smarty->assign('link', $this->context->link);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM