{"id":267476,"date":"2015-11-04T15:25:03","date_gmt":"2015-11-04T12:25:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=267476"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=267476","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f html \u043d\u0430 PHP"},"content":{"rendered":"<p>       \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 html \u043d\u0430 PHP. \u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e, \u043a\u0440\u0430\u0442\u043a\u043e, \u043d\u043e \u0432 \u0442\u043e\u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u043e\u0434\u0435 \u043d\u0435 \u043f\u043b\u043e\u0445\u043e, \u0447\u0435\u043c \u0438 \u0441\u043f\u0435\u0448\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430:<\/p>\n<pre><code class=\"php\">CHtml::create()     -&gt;p()         -&gt;a(array('href' =&gt; 'http:\/\/habrahabr.ru', 'class' =&gt; 'btn'))             -&gt;text('\u041f\u0435\u0440\u0435\u0439\u0442\u0438')     -&gt;render(); <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"html\">&lt;p&gt;&lt;a href=&quot;http:\/\/habrahabr.ru&quot; class=&quot;btn&quot;&gt;\u041f\u0435\u0440\u0435\u0439\u0442\u0438&lt;\/a&gt;&lt;\/p&gt;  <\/code><\/pre>\n<p>  \u041d\u0438\u0447\u0435\u0433\u043e \u0445\u0438\u0442\u0440\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u044d\u0442\u0438\u043c \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u0442\u0441\u044f, \u043d\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0446\u0438\u043a\u043b\u044b:  <\/p>\n<pre><code class=\"php\"> $arr = array('1' =&gt; '\u041f\u0435\u0440\u0432\u044b\u0439', '2' =&gt; '\u0412\u0442\u043e\u0440\u043e\u0439');  CHtml::create() \t -&gt;select($options) \t\t-&gt;each(CHtml::plainArray($arr, 'value', 'text')) \t\t\t-&gt;option('array(&quot;value&quot; =&gt; $data-&gt;value)') \t\t\t\t -&gt;text('$data-&gt;text') \t\t-&gt;end() \t-&gt;endEach()  <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e plainArray() \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u0432\u0438\u0434\u0435:  <\/p>\n<pre><code class=\"php\">$arr = array(     array('value' =&gt; '1', 'text' =&gt;'\u041f\u0435\u0440\u0432\u044b\u0439'),      array('value' =&gt; '2', 'text' =&gt; '\u0412\u0442\u043e\u0440\u043e\u0439') ); <\/code><\/pre>\n<p>  \u0422\u0435\u0433\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 eval \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043b\u044e\u0431\u0430\u044f, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439:<\/p>\n<pre><code class=\"php\">$columns = array(     array('id' =&gt; 'NAME', 'label' =&gt; '\u0418\u043c\u044f'),     array('id' =&gt; 'AGE', 'label' =&gt; '\u0412\u043e\u0437\u0440\u0430\u0441\u0442') );  $data = array(     array('NAME' =&gt; '\u041f\u0435\u0442\u0440', 'AGE' =&gt; 29),     array('NAME' =&gt; '\u0412\u0430\u0441\u0438\u043b\u0438\u0439', 'AGE' =&gt; 32) );  CHtml::create() \t-&gt;table() \t\t-&gt;thead() \t\t\t -&gt;tr() \t\t\t-&gt;each($columns) \t\t\t\t -&gt;th() \t\t\t\t\t-&gt;text(function($column){ \t\t\t\t\t\t return $column['label']; \t\t\t\t\t})                                  -&gt;end() \t\t\t-&gt;endEach()  \t\t\t-&gt;end() \t\t-&gt;end() \t\t\t-&gt;tbody() \t\t\t-&gt;each($data) \t\t\t\t-&gt;tr() \t\t\t\t-&gt;each($columns) \t\t\t\t\t-&gt;td() \t\t\t\t\t\t-&gt;text(function($row, $column) { \t                                              return $row[$column['id']]; \t\t\t\t\t\t}) \t\t\t\t\t-&gt;end() \t\t\t\t-&gt;endEach() \t\t\t\t-&gt;end() \t\t\t-&gt;endEach() -&gt;render(); <\/code><\/pre>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0435\u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u0442\u0435\u0433\u0438 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. <\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c, \u0432\u043f\u043b\u043e\u0442\u044c \u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0430\u0445. \u0420\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430 \u0441\u0447\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0437\u0430 \u0442\u043e, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0433 \u0438 \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"php\"> class CMyHtml extends CHtml {  \tpublic function a($options = array()) { \t\t$default = array( \t\t\t'href' =&gt; 'javascript:void(0)' \t\t); \t\treturn parent::a(array_replace($default, $options)); \t} }  <\/code><\/pre>\n<pre><code class=\"php\">class CForm {                  private $_lastLabel = ''; \tpublic function __construct(CModel $model, CHtml $html = null) { \t\t$this-&gt;_model = $model; \t\t$this-&gt;_html = $html ?: CHtml::create(); \t}  \tpublic function __call($method, $ps) { \t\t$options = $ps ? $ps[0]: array();  \t\tif ($method === 'label') { \t\t\t$this-&gt;_lastLabel = isset($options['for']) ? $this-&gt;_model-&gt;getLabel($options['for']) : ''; \t\t}  \t\tif ($method === 'text' && $this-&gt;_lastLabel) { \t\t\t$options = $options ?: $this-&gt;_lastLabel; \t\t\t$this-&gt;_lastLabel = ''; \t\t}                $this-&gt;_html-&gt;$method($options); \t       return $this;        } } <\/code><\/pre>\n<p>  \u0421\u0430\u043c\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/StagnantIce\/piha-framework\/blob\/master\/piha\/modules\/core\/classes\/CHtml.php\">github<\/a>.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/270147\/\"> http:\/\/habrahabr.ru\/post\/270147\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u0441\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 html \u043d\u0430 PHP. \u0417\u0430\u0434\u0430\u0447\u0430 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u043e, \u043a\u0440\u0430\u0442\u043a\u043e, \u043d\u043e \u0432 \u0442\u043e\u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0441 \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u043e\u0434\u0435 \u043d\u0435 \u043f\u043b\u043e\u0445\u043e, \u0447\u0435\u043c \u0438 \u0441\u043f\u0435\u0448\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430:<\/p>\n<pre><code class=\"php\">CHtml::create()     -&gt;p()         -&gt;a(array('href' =&gt; 'http:\/\/habrahabr.ru', 'class' =&gt; 'btn'))             -&gt;text('\u041f\u0435\u0440\u0435\u0439\u0442\u0438')     -&gt;render(); <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"html\">&lt;p&gt;&lt;a href=&quot;http:\/\/habrahabr.ru&quot; class=&quot;btn&quot;&gt;\u041f\u0435\u0440\u0435\u0439\u0442\u0438&lt;\/a&gt;&lt;\/p&gt;  <\/code><\/pre>\n<p>  \u041d\u0438\u0447\u0435\u0433\u043e \u0445\u0438\u0442\u0440\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u044d\u0442\u0438\u043c \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u0442\u0441\u044f, \u043d\u043e \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0446\u0438\u043a\u043b\u044b:  <\/p>\n<pre><code class=\"php\"> $arr = array('1' =&gt; '\u041f\u0435\u0440\u0432\u044b\u0439', '2' =&gt; '\u0412\u0442\u043e\u0440\u043e\u0439');  CHtml::create() \t -&gt;select($options) \t\t-&gt;each(CHtml::plainArray($arr, 'value', 'text')) \t\t\t-&gt;option('array(&quot;value&quot; =&gt; $data-&gt;value)') \t\t\t\t -&gt;text('$data-&gt;text') \t\t-&gt;end() \t-&gt;endEach()  <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e plainArray() \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u0432\u0438\u0434\u0435:  <\/p>\n<pre><code class=\"php\">$arr = array(     array('value' =&gt; '1', 'text' =&gt;'\u041f\u0435\u0440\u0432\u044b\u0439'),      array('value' =&gt; '2', 'text' =&gt; '\u0412\u0442\u043e\u0440\u043e\u0439') ); <\/code><\/pre>\n<p>  \u0422\u0435\u0433\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0446\u0438\u043a\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441 eval \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043b\u044e\u0431\u0430\u044f, \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439:<\/p>\n<pre><code class=\"php\">$columns = array(     array('id' =&gt; 'NAME', 'label' =&gt; '\u0418\u043c\u044f'),     array('id' =&gt; 'AGE', 'label' =&gt; '\u0412\u043e\u0437\u0440\u0430\u0441\u0442') );  $data = array(     array('NAME' =&gt; '\u041f\u0435\u0442\u0440', 'AGE' =&gt; 29),     array('NAME' =&gt; '\u0412\u0430\u0441\u0438\u043b\u0438\u0439', 'AGE' =&gt; 32) );  CHtml::create() \t-&gt;table() \t\t-&gt;thead() \t\t\t -&gt;tr() \t\t\t-&gt;each($columns) \t\t\t\t -&gt;th() \t\t\t\t\t-&gt;text(function($column){ \t\t\t\t\t\t return $column['label']; \t\t\t\t\t})                                  -&gt;end() \t\t\t-&gt;endEach()  \t\t\t-&gt;end() \t\t-&gt;end() \t\t\t-&gt;tbody() \t\t\t-&gt;each($data) \t\t\t\t-&gt;tr() \t\t\t\t-&gt;each($columns) \t\t\t\t\t-&gt;td() \t\t\t\t\t\t-&gt;text(function($row, $column) { \t                                              return $row[$column['id']]; \t\t\t\t\t\t}) \t\t\t\t\t-&gt;end() \t\t\t\t-&gt;endEach() \t\t\t\t-&gt;end() \t\t\t-&gt;endEach() -&gt;render(); <\/code><\/pre>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-267476","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=267476"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267476\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}