{"id":214085,"date":"2014-02-27T22:50:03","date_gmt":"2014-02-27T18:50:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=214085"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=214085","title":{"rendered":"<span class=\"post_title\">\u041d\u0435\u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043d\u0430 PHP \u0438\u043b\u0438 \u043a\u0430\u043a \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0425\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043d\u0435 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u044f \u043a \u00ab\u0444\u0440\u0438\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u00bb \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u043a\u043e\u0434\u0430.<\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0442\u043e \u0440\u0430\u0437 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0440\u0442\u0430\u043b\u0430 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0432 \u00abback\u00bb \u0442\u0430\u043a \u0438 \u0432 \u00abfront\u00bb \u0438 \u0442\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441 \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c? \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u0442\u043e \u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u0438\u0438 Symfony. \u041d\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u044b\u0448\u043b\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0447\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0441\u0430\u043c \u043d\u0430\u0447\u0430\u043b \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f. \u0418 \u0442\u0443\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434.<\/p>\n<h4>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043b \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414, \u0432\u043e\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043e\u0434\u043d\u043e\u0439:<\/p>\n<pre><code class=\"sql\">CREATE TABLE IF NOT EXISTS `cms_articles` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `title` varchar(255) DEFAULT NULL,   `article` text,   `author` varchar(255) DEFAULT NULL,   `edited` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,   `url` varchar(100) DEFAULT NULL,   `rating` int(10) NOT NULL DEFAULT '0',   `views` int(10) NOT NULL DEFAULT '0',   `comments` int(10) unsigned NOT NULL DEFAULT '0',   `parent` int(10) NOT NULL DEFAULT '0',   `key` text NOT NULL,   `desc` text NOT NULL,   `tags` varchar(250) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB  DEFAULT CHARSET=utf8; <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u0430\u043f\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 HTML \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b. <a name=\"habracut\"><\/a><br \/>  \u0418 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0443\u0442\u044c \u043c\u043e\u0435\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430: <b>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c \u043f\u043e\u043b\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/b><\/p>\n<pre><code class=\"html\">&lt;body&gt; &lt;font size='5px' class='title'&gt;[page:name]&lt;\/font&gt; &lt;span style=&quot;float: right; padding-top: 10px;&quot;&gt;[page:path]&lt;\/span&gt;  [page:message]  &lt;form class=&quot;form-list&quot; action=&quot;&quot; method=&quot;post&quot; name=&quot;Form&quot; enctype=&quot;multipart\/form-data&quot; accept-charset=&quot;UTF-8&quot;&gt;  &lt;div class=&quot;section&quot;&gt; &lt;ul class=&quot;tabs&quot;&gt; \t&lt;li class=&quot;current&quot;&gt;&lt;a href=&quot;#tab1&quot;&gt;\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438 \u0441\u0442\u0430\u0442\u044c\u0438&lt;\/a&gt;&lt;\/li&gt; \t&lt;li class=&quot;&quot;&gt;&lt;a href=&quot;#tab2&quot;&gt;\u0422\u0435\u043a\u0441\u0442 \u0441\u0442\u0430\u0442\u044c\u0438&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; \t &lt;div class=&quot;boxu visible&quot;&gt; \t\t &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a&lt;\/label&gt;&lt;span class=&quot;required&quot;&gt;*&lt;\/span&gt;&lt;br&gt; \t\t&lt;input type=&quot;text&quot; class=&quot;big&quot; value=&quot;&quot; name=&quot;title&quot;&gt; \t&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b&lt;\/label&gt;     &lt;\/div&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c&lt;\/label&gt;&lt;br&gt;                       \t \t&lt;select class=&quot;big&quot; name=&quot;parent&quot; id=&quot;&quot;&gt; \t\t&lt;option selected value=&quot;153&quot;&gt;- \u0431\u0435\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f -&lt;\/option&gt; \t\t[page:parent] \t&lt;\/select&gt;&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430&lt;\/label&gt;&lt;\/div&gt;&lt;div class=&quot;item &quot;&gt; \t \t&lt;label&gt;\u0410\u0434\u0440\u0435\u0441&lt;\/label&gt;&lt;br&gt; \t&lt;input type=&quot;text&quot; class=&quot;medium&quot; value=&quot;&quot; name=&quot;url&quot;&gt; \t&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;URL \u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b&lt;\/label&gt;     &lt;\/div&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0410\u0432\u0442\u043e\u0440&lt;\/label&gt;&lt;br&gt; \t\t&lt;input type=&quot;text&quot; class=&quot;big&quot; value=&quot;&quot; name=&quot;author&quot;&gt; \t&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u0442\u0438 ...&lt;\/label&gt;     &lt;\/div&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435&lt;\/label&gt;&lt;br&gt;                       \t \t&lt;textarea  class=&quot;&quot; name=&quot;desc&quot; rows=&quot;2&quot;&gt;&lt;\/textarea&gt;&lt;br&gt;   \t&lt;label class=&quot;descript&quot;&gt;\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 (\u042f\u043d\u0434\u0435\u043a\u0441, Google...)&lt;\/label&gt; &lt;\/div&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430&lt;\/label&gt;&lt;br&gt;                       \t \t&lt;textarea name=&quot;key&quot; rows=&quot;2&quot;&gt;&lt;\/textarea&gt;&lt;br&gt;  \t&lt;label class=&quot;descript&quot;&gt;\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 (\u042f\u043d\u0434\u0435\u043a\u0441, Google...)&lt;\/label&gt; &lt;\/div&gt;  &lt;table width=&quot;600px&quot;&gt; &lt;tr&gt;&lt;td&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0420\u0435\u0439\u0442\u0438\u043d\u0433&lt;\/label&gt;&lt;br&gt; \t\t&lt;input type=&quot;text&quot; class=&quot;lbig&quot; value=&quot;&quot; name=&quot;rating&quot;&gt; \t&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u0441\u0442\u0430\u0442\u0442\u0438 ...&lt;\/label&gt;     &lt;\/div&gt;  &lt;\/td&gt;&lt;td&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u044b&lt;\/label&gt;&lt;br&gt; \t\t&lt;input type=&quot;text&quot; class=&quot;lbig&quot; value=&quot;&quot; name=&quot;views&quot;&gt; \t&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432 ...&lt;\/label&gt;     &lt;\/div&gt;  &lt;\/td&gt;&lt;\/tr&gt; &lt;\/table&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0420\u0430\u0437\u0440\u0435\u0448\u044b\u0442\u044c \u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435&lt;\/label&gt;&lt;br&gt;   \t&lt;span&gt;&lt;input name=&quot;comments&quot; type=&quot;radio&quot; value=&quot;1&quot; checked&gt;\u0414\u0430&lt;\/span&gt; \t&lt;span&gt;&lt;input name=&quot;comments&quot; type=&quot;radio&quot; value=&quot;0&quot;&gt;\u041d\u0435\u0442&lt;\/span&gt;&lt;br&gt; \t\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.&lt;br&gt; &lt;\/div&gt;  &lt;\/div&gt; \t\t &lt;div class=&quot;boxu&quot;&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0422\u0435\u043a\u0441\u0442&lt;\/label&gt;&lt;br&gt;                       \t \t&lt;textarea name=&quot;article&quot; rows=&quot;28&quot; id=&quot;article&quot;&gt;&lt;\/textarea&gt;&lt;br&gt;   \t&lt;label class=&quot;descript&quot;&gt;\u0422\u0435\u043a\u0441\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 HTML \u0442\u0435\u0433\u043e\u0432&lt;\/label&gt; &lt;\/div&gt;  &lt;div class=&quot;item&quot;&gt; \t&lt;label&gt;\u0422\u0435\u0433\u0438&lt;\/label&gt;&lt;br&gt; \t\t&lt;input type=&quot;text&quot; style=&quot;width: 200px;&quot; value=&quot;&quot; name=&quot;tags&quot; id=&quot;tags&quot;&gt;&lt;br&gt; \t&lt;label class=&quot;descript&quot;&gt;\u0422\u0435\u0433\u0438 \u043a \u0434\u0430\u043d\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443 (\u0412\u0432\u043e\u0434\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u0443).&lt;\/label&gt;     &lt;\/div&gt;  &lt;div class=&quot;item-buttons&quot;&gt; \t&lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c&quot;&gt; &lt;\/div&gt;  &lt;\/div&gt; &lt;\/div&gt;\t\t &lt;\/form&gt; &lt;\/body&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0444\u043e\u0440\u043c\u0430 (\u041e\u0440\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u043e\u0442 \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0430 \u044f \u0438\u0445 \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b):<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/759\/b1f\/b19\/759b1fb19b9edbdc17019f5d0ef47d13.png\"\/><\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u0444\u0430\u0439\u043b, \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u00abarticle.tpl\u00bb. \u0418 \u043d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. \u0414\u043b\u044f \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>DOM<\/b> \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u0443\u0441\u043a\u0430\u0439 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u0442 \u043f\u043e\u0434 \u00absimpleDom\u00bb.<\/p>\n<p>  \u0412\u043e\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u0430 \u043d\u0435 \u043f\u043e ID.<\/p>\n<pre><code class=\"php\">\tprivate function GetElementByName($_dom, $_name){ \t\t\/\/ Experimental search by name \t\t$xpath = new DOMXPath($_dom); \t\treturn $xpath-&gt;query('\/\/*[@name=&quot;'.$_name.'&quot;]')-&gt;item(0); \t} <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0443\u0442 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<pre><code class=\"php\">\tpublic function LoadShowFormAll($query, $template) { \t \t$page_encoding = 'UTF-8';      $dom = new DomDocument();     @$dom-&gt;loadHTML('&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text\/html; charset=' . $page_encoding . '&quot;&gt;' .  file_get_contents(TMP_DIR.$template.&quot;.tpl&quot;));      if ($result = $this-&gt;base-&gt;select($query)) { \t \tforeach ($result as $key =&gt; $value) {\t         $obj = $this-&gt;GetElementByName($dom, $value['name']);  \/\/$dom-&gt;getElementById($val-&gt;name); \t\t             switch ($obj-&gt;nodeName) {                 case &quot;input&quot;:                     if ($obj-&gt;getAttribute('type') == 'radio') {                          $optionTags = $dom-&gt;getElementsByTagName('input');                         for ($i = 0; $i &lt; $optionTags-&gt;length; $i++) {                              if ($optionTags-&gt;item($i)-&gt;getAttribute('name') == $value['name']) {                                 if ($optionTags-&gt;item($i)-&gt;getAttribute('value') == $value['param']) {                                      $optionTags-&gt;item($i)-&gt;SetAttribute('checked', 'checked');                                 }                             }                         }                          if ($value['param'] == 1) {                             $obj-&gt;SetAttribute('checked', 'checked');                         }                     } else                     if ($obj-&gt;getAttribute('type') == 'checkbox') {                          if ($value['param'] == 1) {                             $obj-&gt;SetAttribute('checked', 'checked');                         }                     } else {                         $obj-&gt;SetAttribute('value', $value['param']);                     }                     break;                  case &quot;textarea&quot;:                     $obj-&gt;nodeValue = $value['param'];                     break;                  case &quot;select&quot;:                     $optionTags = $obj-&gt;getElementsByTagName('option');                     for ($i = 0; $i &lt; $optionTags-&gt;length; $i++) {                          if ($optionTags-&gt;item($i)-&gt;getAttribute('value') == $value['param']) {                             $optionTags-&gt;item($i)-&gt;SetAttribute('selected', 'selected');                         }                     }                     break;                  case &quot;&quot;:                     break; \t\t\t} \t\t} \t}\t \tpreg_match_all(&quot;#&lt;body&gt;(.*)&lt;\/body&gt;#isUu&quot;, $dom-&gt;saveHTML(), $str);\t \treturn $str[1][0]; \t} <\/code><\/pre>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"php\">echo $Core-&gt;LoadShowForm('SELECT * FROM cms_articles WHERE id='.(int)($get_id), 'article'); <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0443 \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0445 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0437\u0430\u0434\u0430\u043d\u0438\u0439 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u0432\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"php\">\tpublic function InsertNewValue($post, $table, $custom = null) {      $query = '';     $sep = false;     $tmp = array();      if ($result = $this-&gt;base-&gt;query(&quot;SELECT * FROM `$table` LIMIT 1&quot;)) {         $fields = $result-&gt;fetch_fields();     } else {         return false;         exit();     }      foreach ($post as $col =&gt; $val) {         $col = mysql_real_escape_string($col);         $val = mysql_real_escape_string($val);          $tmp[$col] = $val;     }      if ($custom != null) {          foreach ($custom as $col =&gt; $val) {             $col = mysql_real_escape_string($col);             $val = mysql_real_escape_string($val);              $tmp[$col] = $val;         }     }      foreach ($tmp as $column =&gt; $val) {          foreach ($fields as $fval) {             if ($column == $fval-&gt;name) {                  if ($sep == true) {                     $query .= &quot;, `$column` = '$val'&quot;;                 } else {                     $query .= &quot;`$column` = '$val'&quot;;                 }                 $sep = true;             }         }     }      return $this-&gt;base-&gt;query(&quot;INSERT INTO `$table` SET &quot; . $query); \t}  \tfunction UpdateValue($post, $table, $custom = null, $where) {      $query = '';     $sep = false;     $tmp = array();      if ($result = $this-&gt;base-&gt;query(&quot;SELECT * FROM `$table` LIMIT 1&quot;)) {         $fields = $result-&gt;fetch_fields();     } else {         return false;         exit();     }      foreach ($post as $col =&gt; $val) {         $col = mysql_real_escape_string($col);         $val = mysql_real_escape_string($val);          $tmp[$col] = $val;     }      if ($custom != null) {          foreach ($custom as $col =&gt; $val) {             $col = mysql_real_escape_string($col);             $val = mysql_real_escape_string($val);              $tmp[$col] = $val;         }     }      foreach ($tmp as $column =&gt; $val) {          foreach ($fields as $fval) {             if ($column == $fval-&gt;name) {                  if ($sep == true) {                     $query .= &quot;, `$column` = '$val'&quot;;                 } else {                     $query .= &quot;`$column` = '$val'&quot;;                 }                 $sep = true;             }         }     }      return $this-&gt;base-&gt;query(&quot;UPDATE `$table` SET &quot; . $query . &quot; WHERE &quot; . $where); \t} <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c:  <\/p>\n<pre><code class=\"php\">$Core-&gt;UpdateValue($_POST, 'cms_articles', null, ' id='.(int)($get_id));\t\/\/ \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 $Core-&gt;InsertNewValue($_POST, 'cms_articles');  <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>   \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 (\u041f\u0440\u0438 \u0442\u043e\u043c \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0445 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e: 250).<br \/>  \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0444\u043e\u0440\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0431\u0430\u0437\u0435 \u0438 \u0432\u0441\u0435.<\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e! \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/214085\/\"> http:\/\/habrahabr.ru\/post\/214085\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u0425\u043e\u0447\u0443 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043d\u0435 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u044f \u043a \u00ab\u0444\u0440\u0438\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u00bb \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 \u043a\u043e\u0434\u0430.<\/p>\n<h4>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u0430\u043a \u0442\u043e \u0440\u0430\u0437 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043c\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0440\u0442\u0430\u043b\u0430 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0432 \u00abback\u00bb \u0442\u0430\u043a \u0438 \u0432 \u00abfront\u00bb \u0438 \u0442\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a \u0432\u043e\u043f\u0440\u043e\u0441 \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c? \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u0442\u043e \u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u0438\u0438 Symfony. \u041d\u043e \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u044b\u0448\u043b\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0447\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0441\u0430\u043c \u043d\u0430\u0447\u0430\u043b \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f. \u0418 \u0442\u0443\u0442 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0437\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434.<\/p>\n<h4>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043b \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414, \u0432\u043e\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043e\u0434\u043d\u043e\u0439:<\/p>\n<pre><code class=\"sql\">CREATE TABLE IF NOT EXISTS `cms_articles` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `title` varchar(255) DEFAULT NULL,   `article` text,   `author` varchar(255) DEFAULT NULL,   `edited` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,   `url` varchar(100) DEFAULT NULL,   `rating` int(10) NOT NULL DEFAULT '0',   `views` int(10) NOT NULL DEFAULT '0',   `comments` int(10) unsigned NOT NULL DEFAULT '0',   `parent` int(10) NOT NULL DEFAULT '0',   `key` text NOT NULL,   `desc` text NOT NULL,   `tags` varchar(250) NOT NULL,   PRIMARY KEY (`id`) ) ENGINE=InnoDB  DEFAULT CHARSET=utf8; <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u044d\u0442\u0430\u043f\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 HTML \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b. <\/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-214085","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214085","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=214085"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214085\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}