// Usage: [includeme file="js/products_section_show_hidden_products.js.html" products_section_name_genitive="медицинских принтеров"] - нет! Вставлять на страницу как: header('Content-Type: application/javascript'); // здесь нельзя! Иначе браузер будет всю страницу отображать как скрипт JS. Уже можно, т.к. вставлять на страницу как: // if(isset($attrs['products_section_name_genitive'])) { $products_section_name_genitive = ' для '.$attrs['products_section_name_genitive']; } elseif(!isset($products_section_name_genitive)) { $products_section_name_genitive = ''; /* Будет просто: ПОКАЗАТЬ ЗАПЧАСТИ */ } else { $products_section_name_genitive = ' для '.$products_section_name_genitive; /* Например: медицинских принтеров */ } $words = array('show' => 'Показать', 'hide' => 'Скрыть'); if(isset($_SERVER['HTTP_REFERER'])) { // } else { header('Content-Type: application/javascript'); echo '/* Nothing to see here. */'; } // прячем наш скрипт от любопытных глаз. ?>