douzhao4071 2013-12-11 21:34
浏览 45
已采纳

在块插件期间禁用PHP Smarty中的剥离

We're using Smarty to generate HTML from PHP. A number of plugins have been added to make life easier.

One of these plugins is a block plugin that interprets a custom language and generates HTML code. The custom language has simple statement, using linebreaks to separate the statements. Smarty's builtin {strip} plugin concatenates these statements onto a single line, making the language fail.

For instance, this is the input:

<div>
{table}
    column "Size" sortable editable number
    column "Color" sortable editable color
{/table}
</div>

If this is placed within a {strip}, the statements get concatenated and the language is no longer valid.

The simple solution is to place {/strip} and {strip} just outside the block plugin's open and close tags. However, this requires our template designers to remember this peculiarity (they don't).

Is there any way to disable {strip} for the content of a Smarty plugin?

  • 写回答

1条回答 默认 最新

  • dragonsun00000 2013-12-26 21:53
    关注

    I think the {literal} tag should escape stripping:

    <div>
    {table}{literal}
        column "Size" sortable editable number
        column "Color" sortable editable color
    {/literal}{/table}
    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭