【问题标题】:gallery3, using html in form-labelgallery3,在表单标签中使用 html
【发布时间】:2011-12-12 23:04:04
【问题描述】:

我正在尝试修改gallery3 的注册模块。我在表单中添加了一个新元素(由 Forge 生成),但想添加一个指向相关标签的超链接。不幸的是,它被脚本转义了,即使是 html::mark_clean() 也没有帮助。

这是我的代码:

$form = new Forge("register/handler", "", "post", array("id" => "g-register-form"));
$group = $form->group("register_user")->label(t("Register user"));

$group->checkbox("accept_terms")->label(html::mark_clean(t(html::mark_clean('I confirm to have read the <a href="%url">terms of usage</a>.'), 
          array("url" => html::mark_clean("http://www.google.de")))))
          ->id("g-accept-terms")
  ->rules("required")
  ->error_messages("accept", t("You have to accept the terms of usage before you may register."));

如您所见,出于测试目的,我在不同位置添加了 mark_clean。

结果如下:

<label>
  <input type="checkbox" class="checkbox" value="1" name="accept_terms" id="g-accept-terms">
  I confirm to have read the &lt;a href="http://www.google.de"&gt;terms of usage&lt;/a&gt;.
</label>

我想避免更改任何现有的核心文件。 感谢您的帮助!

【问题讨论】:

    标签: php html forms kohana


    【解决方案1】:
    $group->checkbox("accept_terms")->label(t('I confirm to have read the <a href="http://yourURL.com/" target="_blank">terms of usage</a>.  more text'))
      ->rules("required")
      ->error_messages("accept", t("You have to accept the terms of usage before you may register."));
    

    【讨论】:

    • 对不起,但这绝对不是我问题的答案。正如我在第一篇文章中所写,所有 html 都被系统转义了。
    猜你喜欢
    • 2016-07-21
    • 1970-01-01
    • 2015-03-03
    • 1970-01-01
    • 2013-12-25
    • 2016-04-10
    • 2011-06-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多