当前位置: 首页>>代码示例>>PHP>>正文


PHP Forge::__toString方法代码示例

本文整理汇总了PHP中Forge::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::__toString方法的具体用法?PHP Forge::__toString怎么用?PHP Forge::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Forge的用法示例。


在下文中一共展示了Forge::__toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Forge

 function group_test()
 {
     $form = new Forge("test/controller", "", "post", array("id" => "gTestGroupForm"));
     $group = $form->group("test_group")->label(t("Test Group"));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Text Area"));
     $group->submit("")->value(t("Submit"));
     $rendered = $form->__toString();
     $expected = "<form action=\"http://./index.php/test/controller\" method=\"post\" " . "id=\"gTestGroupForm\">\n" . "<input type=\"hidden\" name=\"csrf\" value=\"" . access::csrf_token() . "\"  />\n" . "  <fieldset>\n" . "    <legend>Test Group</legend>\n" . "    <ul>\n" . "      <li>\n" . "        <label for=\"title\" >Title</label>\n" . "        <input type=\"text\" id=\"title\" name=\"title\" value=\"\" " . "class=\"textbox\"  />\n" . "      </li>\n" . "      <li>\n" . "        <label for=\"description\" >Text Area</label>\n" . "        <textarea id=\"description\" name=\"description\" " . "class=\"textarea\" ></textarea>\n" . "      </li>\n" . "      <li>\n" . "        <input type=\"submit\" value=\"Submit\" class=\"submit\"  />\n" . "      </li>\n" . "    </ul>\n" . "  </fieldset>\n" . "</form>\n";
     $this->assert_same($expected, $rendered);
 }
开发者ID:xafr,项目名称:gallery3,代码行数:11,代码来源:DrawForm_Test.php

示例2: Forge

 function form_script_test()
 {
     $form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form"));
     $group = $form->group("test_group")->label(t("Test Group"));
     $group->input("title")->label(t("Title"));
     $group->textarea("description")->label(t("Text Area"));
     $form->script("")->url(url::file("test.js"))->text("alert('Test Javascript');");
     $group->submit("")->value(t("Submit"));
     $rendered = $form->__toString();
     $csrf = access::csrf_token();
     $expected = "<form action=\"http://./index.php/test/controller\" method=\"post\" " . "id=\"g-test-group-form\">\n" . "<input type=\"hidden\" name=\"csrf\" value=\"{$csrf}\"  />" . "  <fieldset>\n" . "    <legend>Test Group</legend>\n" . "    <ul>\n" . "      <li>\n" . "        <label for=\"title\" >Title</label>\n" . "        <input type=\"text\" name=\"title\" value=\"\" " . "class=\"textbox\"  />\n" . "      </li>\n" . "      <li>\n" . "        <label for=\"description\" >Text Area</label>\n" . "        <textarea name=\"description\" rows=\"\" cols=\"\" " . "class=\"textarea\" ></textarea>\n" . "      </li>\n" . "      <li>\n" . "        <input type=\"submit\" value=\"Submit\" class=\"submit\"  />\n" . "      </li>\n" . "    </ul>\n" . "  </fieldset>\n" . "<script type=\"text/javascript\" src=\"http://./test.js\"></script>\n\n" . "<script type=\"text/javascript\">\n" . "alert('Test Javascript');\n" . "</script>\n" . "</form>";
     $this->assert_same($expected, $rendered);
 }
开发者ID:viosca,项目名称:gallery3,代码行数:13,代码来源:DrawForm_Test.php


注:本文中的Forge::__toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。