Cakephp3: Render/Evaluate HTML inside label formhelper

情到浓时终转凉″ 提交于 2021-01-27 04:21:53

问题


How you place html inside label in cakephp3?

I need to achieve * Name:

using the code below

<?php
    echo $this->Form->input ( 'name', [ 
            'label' => [ 
                    'text' => '<span class="red">*</span> Name:',
                    'class' => 'col-sm-12 col-md-2 col-lg-1 control-label' 
            ],
            'class' => 'form-control',
            'rows' => 1 
    ] );

回答1:


Pretty much as always, use the escape option.

echo $this->Form->input('name', [ 
    'label' => [ 
        // ...
        'escape' => false
    ],
    // ...
]);


来源:https://stackoverflow.com/questions/27991447/cakephp3-render-evaluate-html-inside-label-formhelper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!