Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 Magento 模块开发一些视图,我想知道是否有快捷功能可用于生成 HTML 标签,而不是通常的 printf/sprintf。例如,一些框架提供Anchor()诸如标记,或TextBox(),它打印一个完整的标签。
Anchor()
TextBox()
Magento 有类似的东西,还是我必须坚持“ printf ”方法?提前感谢您的答案。
不,Magento 的 Blocks(我假设你问的是关于 re: Views 的问题)不提供 HTML 生成方法。您需要在 PHP 中手动生成 HTML 代码或使用模板块,这允许您在模板文件中编写自己的 html 代码phtml,然后将该代码与调用
phtml
<a href="<?php echo $link; ?>"><?php echo $label; ?></a>
或者
<a href="<?=$link;?>"><?= $label; ?></a>
取决于你的角色