Тег TITLE

W-Shadow.com

How To Extract HTML Tags And Their Attributes With PHP

There are several ways to extract specific tags from an HTML document. The one that most people will think of first is probably regular expressions. However, this is not always – or, as some would insist, ever – the best approach. Regular expressions can be handy for small hacks, but using a real HTML parser will usually lead to simpler and more robust code. Complex queries, like “find all rows with the class .foo of the second table of this document and return all links contained in those rows”, can also be done much easier with a decent parser.

There are some (though very few they may be) edge case where regular expressions might work better, so I will discuss both approaches in this post.

Extracting Tags With DOM

PHP 5 comes with a usable DOM API built-in that you can use to parse and manipulate (X)HTML documents. For example, here’s how you could use it to extract all link URLs from a HTML file :

//Load the HTML page $html = file_get_contents('page.htm'); //Create a new DOM document $dom = new DOMDocument; //Parse the HTML. The @ is used to suppress any parsing errors //that will be thrown if the $html string isn't valid XHTML. @$dom->loadHTML($html); //Get all links. You could also use any other tag name here, //like 'img' or 'table', to extract other tags. $links = $dom->getElementsByTagName('a'); //Iterate over the extracted links and display their URLs foreach ($links as $link)< //Extract and show the "href" attribute. echo $link->getAttribute('href'), '
'; >

In addition to getElementsByTagName() you can also use $dom->getElementById() to find tags with a specific id. For more complex tasks, like extracting deeply nested tags, XPath is probably the way to go. For example, to find all list items with the class “foo” containing links with the class “bar” and display the link URLs :

//Load the HTML page $html = file_get_contents('page.htm'); //Parse it. Here we use loadHTML as a static method //to parse the HTML and create the DOM object in one go. @$dom = DOMDocument::loadHTML($html); //Init the XPath object $xpath = new DOMXpath($dom); //Query the DOM $links = $xpath->query( '//li[contains(@class, "foo")]//a[@class = "bar"]' ); //Display the results as in the previous example foreach($links as $link)< echo $link->getAttribute('href'), '
'; >

For more information about DOM and XPath see these resources :

Читайте также:  Pid run php fpm pid

Honourable mention : Simple HTML DOM Parser is a popular alternative HTML parser for PHP 5 that lets you manipulate HTML pages with jQuery-like ease. However, I personally wouldn’t recommend using it if you care about your script’s performance, as in my tests Simple HTML DOM was about 30 times slower than DOMDocument.

Extracting Tags & Attributes With Regular Expressions

There are only two advantages to processing HTML with regular expressions – availability and edge-case performance. While most parsers require PHP 5 or later, regular expressions are available pretty much anywhere. Also, they are a little bit faster than real parsers when you need to extract something from a very large document (on the order of 400 KB or more). Still, in most cases you’re better off using the PHP DOM extension or even Simple HTML DOM, not messing with convoluted regexps.

That said, here’s a PHP function that can extract any HTML tags and their attributes from a given string :

/** * extract_tags() * Extract specific HTML tags and their attributes from a string. * * You can either specify one tag, an array of tag names, or a regular expression that matches the tag name(s). * If multiple tags are specified you must also set the $selfclosing parameter and it must be the same for * all specified tags (so you can't extract both normal and self-closing tags in one go). * * The function returns a numerically indexed array of extracted tags. Each entry is an associative array * with these keys : * tag_name - the name of the extracted tag, e.g. "a" or "img". * offset - the numberic offset of the first character of the tag within the HTML source. * contents - the inner HTML of the tag. This is always empty for self-closing tags. * attributes - a name -> value array of the tag's attributes, or an empty array if the tag has none. * full_tag - the entire matched tag, e.g. 'example.com'. This key * will only be present if you set $return_the_entire_tag to true. * * @param string $html The HTML code to search for tags. * @param string|array $tag The tag(s) to extract. * @param bool $selfclosing Whether the tag is self-closing or not. Setting it to null will force the script to try and make an educated guess. * @param bool $return_the_entire_tag Return the entire matched tag in 'full_tag' key of the results array. * @param string $charset The character set of the HTML code. Defaults to ISO-8859-1. * * @return array An array of extracted tags, or an empty array if no matching tags were found. */ function extract_tags( $html, $tag, $selfclosing = null, $return_the_entire_tag = false, $charset = 'ISO-8859-1' ) < if ( is_array($tag) )< $tag = implode('|', $tag); >//If the user didn't specify if $tag is a self-closing tag we try to auto-detect it //by checking against a list of known self-closing tags. $selfclosing_tags = array( 'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta', 'col', 'param' ); if ( is_null($selfclosing) ) < $selfclosing = in_array( $tag, $selfclosing_tags ); >//The regexp is different for normal and self-closing tags because I can't figure out //how to make a sufficiently robust unified one. if ( $selfclosing )< $tag_pattern = '@<(?P'.$tag.') # \s[^>]+)? # attributes, if any \s*/?> # /> or just >, being lenient here @xsi'; > else < $tag_pattern = '@<(?P'.$tag.') # \s[^>]+)? # attributes, if any \s*> # > (?P.*?) # tag contents # the closing @xsi'; > $attribute_pattern = '@ (?P\w+) # attribute name \s*=\s* ( (?P[\"\'])(?P.*?)(?P=quote) # a quoted value | # or (?P[^\s"\']+?)(?:\s+|$) # an unquoted value (terminated by whitespace or EOF) ) @xsi'; //Find all tags if ( !preg_match_all($tag_pattern, $html, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE ) ) < //Return an empty array if we didn't find anything return array(); >$tags = array(); foreach ($matches as $match)< //Parse tag attributes, if any $attributes = array(); if ( !empty($match['attributes'][0]) )< if ( preg_match_all( $attribute_pattern, $match['attributes'][0], $attribute_data, PREG_SET_ORDER ) )< //Turn the attribute data into a name->value array foreach($attribute_data as $attr) < if( !empty($attr['value_quoted']) )< $value = $attr['value_quoted']; >else if( !empty($attr['value_unquoted']) ) < $value = $attr['value_unquoted']; >else < $value = ''; >//Passing the value through html_entity_decode is handy when you want //to extract link URLs or something like that. You might want to remove //or modify this call if it doesn't fit your situation. $value = html_entity_decode( $value, ENT_QUOTES, $charset ); $attributes[$attr['name']] = $value; > > > $tag = array( 'tag_name' => $match['tag'][0], 'offset' => $match[0][1], 'contents' => !empty($match['contents'])?$match['contents'][0]:'', //empty for self-closing tags 'attributes' => $attributes, ); if ( $return_the_entire_tag ) < $tag['full_tag'] = $match[0][0]; >$tags[] = $tag; > return $tags; >

Usage examples

Extract all links and output their URLs :

$html = file_get_contents( 'example.html' ); $nodes = extract_tags( $html, 'a' ); foreach($nodes as $link)< echo $link['attributes']['href'] , '
'; >

Extract all heading tags and output their text :

$nodes = extract_tags( $html, 'h\d+', false ); foreach($nodes as $node)< echo strip_tags($link['contents']) , '
'; >
$nodes = extract_tags( $html, 'meta' );

Extract bold and italicised text fragments :

$nodes = extract_tags( $html, array('b', 'strong', 'em', 'i') ); foreach($nodes as $node)< echo strip_tags( $node['contents'] ), '
'; >

The function is pretty well documented, so check the source if anything is unclear. Of course, you can also leave a comment if you have any further questions or feedback.

Related posts :

This entry was posted on Tuesday, October 20th, 2009 at 17:35 and is filed under Web Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Источник

Извлечение данных с помощью регулярных выражений PHP

Получение данных с помощью функций preg_match() и preg_match_all() .

Текст из скобок

Извлечение содержимого из круглых, квадратных и фигурных скобок:

$text = ' Телеобъектив: диафрагма [ƒ/2.8] Широкоугольный объектив: (диафрагма ƒ/1.8) По беспроводной сети: Поддержка диапазона: '; /* [. ] */ preg_match_all("/\[(.+?)\]/", $text, $matches); print_r($matches[1]); /* (. ) */ preg_match_all("/\((.+?)\)/", $text, $matches); print_r($matches[1]); /* */ preg_match_all("/\<(.+?)\>/", $text, $matches); print_r($matches[1]); /* */ preg_match_all("/\<(.+?)\>/", $text, $matches); print_r($matches[1]);

Результат:

Array ( [0] => ƒ/2.8 ) Array ( [0] => диафрагма ƒ/1.8 ) Array ( [0] => до 13 часов ) Array ( [0] => Dolby Vision и HDR10 )

Текст из HTML тегов

$text = '  

Тег H1

Текст 1

Текст 2

'; /* */ preg_match('/<title[^>]*?>(.*?)/si', $text, $matches); echo $matches[1]; /* <h2>*/ preg_match('/<h1[^>]*?>(.*?)/si', $text, $matches); echo $matches[1]; /* Извлекает текст из всех <p>*/ preg_match_all('/<p[^>]*?>(.*?)/si', $text, $matches); print_r($matches[1]);</code></pre> <h4 id="rezultat-2">Результат:</h4> <pre><code >Тег TITLE Тег H1 Array ( [0] => Текст 1 [1] => Текст 2 )</code></pre> <h2 id="url-iz-teksta"> URL из текста </h2> <pre><code >$text = 'Text http://ya.ru text http://google.ru text.'; preg_match_all('/(http:\/\/|https:\/\/)?(www)?([\da-z\.-]+)\.([a-z\.])([\/\w\.-\?\%\&]*)*\/?/i', $text, $matches); print_r($matches[0]);</code></pre> <h4 id="rezultat-3">Результат:</h4> <pre><code >Array ( [0] => http://ya.ru [1] => http://google.ru )</code></pre> <h2 id="href-iz-ssylok"> href из ссылок </h2> <pre><code >$text = ' Яндекс Google Mail.ru '; preg_match_all('//i', $text, $matches); print_r($matches[1]);</code></pre> <h4 id="rezultat-4">Результат:</h4> <pre><code >Array ( [0] => http://ya.ru [1] => http://google.ru [2] => http://mail.ru )</code></pre> <h2 id="ankory-ssylok"> Анкоры ссылок </h2> <pre><code >$text = ' Яндекс Google Mail.ru '; preg_match_all('/(.*?)/i', $text, $matches); print_r($matches[1]);</code></pre> <h4 id="rezultat-5">Результат:</h4> <pre><code >Array ( [0] => Яндекс [1] => Google [2] => Mail.ru )</code></pre> <h2 id="src-iz-tegov-img"> Src из тегов img </h2> <pre><code >$text = 'text text'; preg_match_all('//is', $text, $matches); print_r($matches[1]);</code></pre> <h4 id="rezultat-6">Результат:</h4> <h2 id="e-mail-adresa-iz-teksta"> E-mail адреса из текста </h2> <pre><code >$text = 'text admin@mail.ru text text text admin@ya.ru'; preg_match_all('/([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]/i', $text, $matches); print_r($matches[0]);</code></pre> <h4 id="rezultat-7">Результат:</h4> <pre><code >Array ( [0] => admin@mail.ru [1] => admin@ya.ru )</code></pre> <h2 id="tsveta"> Цвета </h2> <h3 id="hex-hexa">HEX/HEXA</h3> <pre><code >$css = ' body < color: #000; background: #4545; >header < color: #111111; background: #00000080; >'; preg_match_all('/#(?:[0-9a-f])/i', $css, $matches); print_r($matches[0]);</code></pre> <h4 id="rezultat-8">Результат:</h4> <pre><code >Array ( [0] => #000 [1] => #4545 [2] => #111111 [3] => #00000080 )</code></pre> <h3 id="rgb-rgba">RGB/RGBA</h3> <pre><code >$css = ' body < color: rgb(0,0,0); background: rgba(17,85,68,0.33); >header < color: rgb(17,17,17); background: rgba(0,0,0,0.5); >'; preg_match_all('/((rgba)\((\d,\s?)(1|0?\.?\d+)\)|(rgb)\(\d(,\s?\d)\))/i', $css, $matches); print_r($matches[0]);</code></pre> <pre><code >Array ( [0] => rgb(0,0,0) [1] => rgba(17,85,68,0.33) [2] => rgb(17,17,17) [3] => rgba(0,0,0,0.5) )</code></pre> <p><a href="https://snipp.ru/php/preg-match">Источник</a></p> <h2 id="how-to-get-html-tag-value-in-php-domdocument">How to Get HTML Tag Value in PHP | DOMDocument Object</h2> <p><img decoding="async" src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E" data-lazy-src="https://onlinewebtutorblog.com/ezoimgfmt/i1.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/How-to-Get-HTML-Tag-Value-in-PHP-DOMDocument-Object.png?w=725&ssl=1"/><noscript><img decoding="async" src="https://onlinewebtutorblog.com/ezoimgfmt/i1.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/How-to-Get-HTML-Tag-Value-in-PHP-DOMDocument-Object.png?w=725&ssl=1"/></noscript></p> <p>Inside this article we will see the concept i.e How to get HTML tag value in PHP. If you are looking of an article which makes you understand about How to parse HTML tags and elements then this article is best to get those concept.</p> <p>DOMDocument object of PHP used to parse HTML string value. If we want to get tag name, it’s values etc then object will help for all those.</p> <p>DOMDocument of PHP also termed as PHP DOM Parser. We will see step by step concept to get the HTML tag value using DOM parser.</p> <h2 id="example-1-php-get-html-element-value">Example 1: PHP Get HTML Element Value</h2> <p>Create a file <strong>index.php</strong> at your localhost directory. Open index.php and write this complete code into it.</p> <pre><body><p>This is Sample Text Message 1</p><p>This is Sample Text Message 2</p><p>This is Sample Text Message 3</p></body></html>"; // DOM Parser Object $htmlDom = new DOMDocument(); $htmlDom->loadHTML($htmlElement); $paragraphTags = $htmlDom->getElementsByTagName('p'); foreach ($paragraphTags as $paragraph) < echo $paragraph->nodeValue . "<br/>"; ></pre> <p><img decoding="async" src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E" data-lazy-src="https://onlinewebtutorblog.com/ezoimgfmt/i2.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/html-domdocument-object-html-parser-in-PHP.png?w=632&ssl=1"/><noscript><img decoding="async" src="https://onlinewebtutorblog.com/ezoimgfmt/i2.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/html-domdocument-object-html-parser-in-PHP.png?w=632&ssl=1"/></noscript></p> <p><strong>Concept</strong></p> <p>Here, we are getting all paragraph tags by Tag <strong>“P”</strong></p> <pre>$paragraphTags = $htmlDom->getElementsByTagName('p');</pre> <p><img decoding="async" src="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E" data-lazy-src="https://onlinewebtutorblog.com/ezoimgfmt/i0.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/get-all-paragraphs-html-dom-parser-object-php.png?w=615&ssl=1"/><noscript><img decoding="async" src="https://onlinewebtutorblog.com/ezoimgfmt/i0.wp.com/onlinewebtutorblog.com/wp-content/uploads/2021/09/get-all-paragraphs-html-dom-parser-object-php.png?w=615&ssl=1"/></noscript></p> <p>When we run index.php. Here is the output</p> <pre>This is Sample Text Message 1 This is Sample Text Message 2 This is Sample Text Message 3</pre> <h2 id="example-2-php-get-html-element-value-by-id">Example 2: PHP Get HTML Element Value By ID</h2> <p>Let’s assume the given string value for this example. Open <strong>index.php</strong> and write this complete code into it.</p> <p><pre><body><p is a sample text message for Testing.</p> </body></html>"; // DOM Parser Object $htmlDom = new DOMDocument(); $htmlDom->loadHTML($htmlString); $paragraphTagValue = $htmlDom->getElementById('sampleParagraph')->nodeValue; echo $paragraphTagValue;</pre> <p>Here, nodeValue returns value of node by it’s ID.</p> <pre>$htmlDom->getElementById('sampleParagraph')->nodeValue;</pre> <p>When we run index.php. Here is the output</p> <pre>This is a sample text message for Testing…</pre> <p>We hope this article helped you to learn How to Get HTML Tag Value in PHP i.e DOMDocument Object in a very detailed way.</p> <p>Online Web Tutor invites you to try <strong>Skillshike</strong>! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.</p> <p>If you liked this article, then please subscribe to our <strong>YouTube Channel</strong> for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on <strong>Twitter</strong> and <strong>Facebook</strong>.</p> <h3 id="related-posts">Related Posts:</h3> <p><a href="https://onlinewebtutorblog.com/how-to-get-html-tag-value-in-php-domdocument-object/">Источник</a></p> <div class="fpm_end"></div> </div><!-- .entry-content --> </article> <div class="rating-box"> <div class="rating-box__header">Оцените статью</div> <div class="wp-star-rating js-star-rating star-rating--score-0" data-post-id="180511" data-rating-count="0" data-rating-sum="0" data-rating-value="0"><span class="star-rating-item js-star-rating-item" data-score="1"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="i-ico"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class="ico-star"></path></svg></span><span class="star-rating-item js-star-rating-item" data-score="2"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="i-ico"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class="ico-star"></path></svg></span><span class="star-rating-item js-star-rating-item" data-score="3"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="i-ico"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class="ico-star"></path></svg></span><span class="star-rating-item js-star-rating-item" data-score="4"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="i-ico"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class="ico-star"></path></svg></span><span class="star-rating-item js-star-rating-item" data-score="5"><svg aria-hidden="true" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" class="i-ico"><path fill="currentColor" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" class="ico-star"></path></svg></span></div> </div> <div class="entry-social"> <div class="social-buttons"><span class="social-button social-button--vkontakte" data-social="vkontakte" data-image=""></span><span class="social-button social-button--facebook" data-social="facebook"></span><span class="social-button social-button--telegram" data-social="telegram"></span><span class="social-button social-button--odnoklassniki" data-social="odnoklassniki"></span><span class="social-button social-button--twitter" data-social="twitter"></span><span class="social-button social-button--sms" data-social="sms"></span><span class="social-button social-button--whatsapp" data-social="whatsapp"></span></div> </div> <meta itemprop="author" content="admin"> <meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://indeksstroy.ru/teg-title-16/" content="Тег TITLE"> <meta itemprop="dateModified" content="2023-08-27"> <meta itemprop="datePublished" content="2023-08-29T14:59:28+03:00"> <div itemprop="publisher" itemscope itemtype="https://schema.org/Organization" style="display: none;"><meta itemprop="name" content="Программирование"><meta itemprop="telephone" content="Программирование"><meta itemprop="address" content="https://indeksstroy.ru"></div> </main><!-- #main --> </div><!-- #primary --> <aside id="secondary" class="widget-area" itemscope itemtype="http://schema.org/WPSideBar"> <div class="sticky-sidebar js-sticky-sidebar"> <div id="block-2" class="widget widget_block"><div class="flatPM_sidebar" data-top="70"> <div id="Q_sidebar"></div> </div></div> </div> </aside><!-- #secondary --> <div id="related-posts" class="related-posts fixed"><div class="related-posts__header">Вам также может понравиться</div><div class="post-cards post-cards--vertical"> <div class="post-card post-card--related post-card--thumbnail-no"> <div class="post-card__title"><a href="https://indeksstroy.ru/yaschiki-s-usami-python/">Ящики с усами python</a></div><div class="post-card__description">pandas.plotting.boxplot# Make a box-and-whisker plot</div> </div> <div class="post-card post-card--related post-card--thumbnail-no"> <div class="post-card__title"><a href="https://indeksstroy.ru/primer-ispolzovaniya-svoystva-css-table-layout-74/">Пример использования свойства CSS table-layout.</a></div><div class="post-card__description">table-layout¶ Свойство table-layout определяет, как</div> </div> <div class="post-card post-card--related post-card--thumbnail-no"> <div class="post-card__title"><a href="https://indeksstroy.ru/primer-ispolzovaniya-svoystva-css-table-layout-73/">Пример использования свойства CSS table-layout.</a></div><div class="post-card__description">HTML Размеры таблицы HTML таблицы могут иметь разные</div> </div> <div class="post-card post-card--related post-card--thumbnail-no"> <div class="post-card__title"><a href="https://indeksstroy.ru/primer-ispolzovaniya-svoystva-css-table-layout-72/">Пример использования свойства CSS table-layout.</a></div><div class="post-card__description">table-layout¶ Свойство table-layout определяет, как</div> </div> </div></div> </div><!--.site-content-inner--> </div><!--.site-content--> <div class="site-footer-container "> <div class="footer-navigation fixed" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div class="main-navigation-inner full"> <div class="menu-tehnicheskoe-menyu-container"><ul id="footer_menu" class="menu"><li id="menu-item-12637" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-12637"><a href="https://indeksstroy.ru/pravoobladatelyam/">Правообладателям</a></li> <li id="menu-item-12638" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-12638"><a href="https://indeksstroy.ru/politika-konfidentsialnosti/">Политика конфиденциальности</a></li> <li id="menu-item-12639" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-12639"><a href="https://indeksstroy.ru/kontakty/">Контакты</a></li> </ul></div> </div> </div><!--footer-navigation--> <footer id="colophon" class="site-footer site-footer--style-gray full"> <div class="site-footer-inner fixed"> <div class="footer-bottom"> <div class="footer-info"> © 2024 Программирование </div> <div class="footer-counters"><!-- Yandex.Metrika counter --> <script type="text/javascript" > (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)}; m[i].l=1*new Date(); for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }} k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)}) (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym"); ym(98905868, "init", { clickmap:true, trackLinks:true, accurateTrackBounce:true, webvisor:true }); </script> <noscript><div><img src="https://mc.yandex.ru/watch/98905868" style="position:absolute; left:-9999px;" alt=""/></div></noscript> <!-- /Yandex.Metrika counter --></div></div> </div> </footer><!--.site-footer--> </div> <button type="button" class="scrolltop js-scrolltop"></button> </div><!-- #page --> <script>var pseudo_links = document.querySelectorAll(".pseudo-clearfy-link");for (var i=0;i<pseudo_links.length;i++ ) { pseudo_links[i].addEventListener("click", function(e){ window.open( e.target.getAttribute("data-uri") ); }); }</script><script type="text/javascript" id="reboot-scripts-js-extra"> /* <![CDATA[ */ var settings_array = {"rating_text_average":"\u0441\u0440\u0435\u0434\u043d\u0435\u0435","rating_text_from":"\u0438\u0437","lightbox_display":"1","sidebar_fixed":"1"}; var wps_ajax = {"url":"https:\/\/indeksstroy.ru\/wp-admin\/admin-ajax.php","nonce":"ea4cb145f7"}; /* ]]> */ </script> <script type="text/javascript" src="https://indeksstroy.ru/wp-content/themes/reboot/assets/js/scripts.min.js" id="reboot-scripts-js"></script> <script>window.lazyLoadOptions = [{ elements_selector: "img[data-lazy-src],.rocket-lazyload,iframe[data-lazy-src]", data_src: "lazy-src", data_srcset: "lazy-srcset", data_sizes: "lazy-sizes", class_loading: "lazyloading", class_loaded: "lazyloaded", threshold: 300, callback_loaded: function(element) { if ( element.tagName === "IFRAME" && element.dataset.rocketLazyload == "fitvidscompatible" ) { if (element.classList.contains("lazyloaded") ) { if (typeof window.jQuery != "undefined") { if (jQuery.fn.fitVids) { jQuery(element).parent().fitVids(); } } } } }},{ elements_selector: ".rocket-lazyload", data_src: "lazy-src", data_srcset: "lazy-srcset", data_sizes: "lazy-sizes", class_loading: "lazyloading", class_loaded: "lazyloaded", threshold: 300, }]; window.addEventListener('LazyLoad::Initialized', function (e) { var lazyLoadInstance = e.detail.instance; if (window.MutationObserver) { var observer = new MutationObserver(function(mutations) { var image_count = 0; var iframe_count = 0; var rocketlazy_count = 0; mutations.forEach(function(mutation) { for (var i = 0; i < mutation.addedNodes.length; i++) { if (typeof mutation.addedNodes[i].getElementsByTagName !== 'function') { continue; } if (typeof mutation.addedNodes[i].getElementsByClassName !== 'function') { continue; } images = mutation.addedNodes[i].getElementsByTagName('img'); is_image = mutation.addedNodes[i].tagName == "IMG"; iframes = mutation.addedNodes[i].getElementsByTagName('iframe'); is_iframe = mutation.addedNodes[i].tagName == "IFRAME"; rocket_lazy = mutation.addedNodes[i].getElementsByClassName('rocket-lazyload'); image_count += images.length; iframe_count += iframes.length; rocketlazy_count += rocket_lazy.length; if(is_image){ image_count += 1; } if(is_iframe){ iframe_count += 1; } } } ); if(image_count > 0 || iframe_count > 0 || rocketlazy_count > 0){ lazyLoadInstance.update(); } } ); var b = document.getElementsByTagName("body")[0]; var config = { childList: true, subtree: true }; observer.observe(b, config); } }, false);</script><script data-no-minify="1" async src="https://indeksstroy.ru/wp-content/plugins/rocket-lazy-load/assets/js/16.1/lazyload.min.js"></script><script>function lazyLoadThumb(e,alt){var t='<img loading="lazy" src="https://i.ytimg.com/vi/ID/hqdefault.jpg" alt="" width="480" height="360">',a='<button class="play" aria-label="play Youtube video"></button>';t=t.replace('alt=""','alt="'+alt+'"');return t.replace("ID",e)+a}function lazyLoadYoutubeIframe(){var e=document.createElement("iframe"),t="ID?autoplay=1";t+=0===this.parentNode.dataset.query.length?'':'&'+this.parentNode.dataset.query;e.setAttribute("src",t.replace("ID",this.parentNode.dataset.src)),e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","1"),e.setAttribute("allow", "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"),this.parentNode.parentNode.replaceChild(e,this.parentNode)}document.addEventListener("DOMContentLoaded",function(){var e,t,p,a=document.getElementsByClassName("rll-youtube-player");for(t=0;t<a.length;t++)e=document.createElement("div"),e.setAttribute("data-id",a[t].dataset.id),e.setAttribute("data-query", a[t].dataset.query),e.setAttribute("data-src", a[t].dataset.src),e.innerHTML=lazyLoadThumb(a[t].dataset.id,a[t].dataset.alt),a[t].appendChild(e),p=e.querySelector('.play'),p.onclick=lazyLoadYoutubeIframe});</script> </body> </html>