Last active
July 6, 2021 10:18
-
-
Save Mahno74/20badb82a2a8c53ad58fae2a1b25dc91 to your computer and use it in GitHub Desktop.
WEB Доработки на сайт
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// добавялем кнопку очищающют текстовое поле | |
<input type="text" id="MyTextInput" name="filter_name" size="30" value="test"> | |
<input type="button" value="Clear" onclick="document.getElementById('MyTextInput').value = null;"> | |
//Вызываем PHP код из скрипта JS | |
//Переход на страницук PHP | |
<button onclick="window.location.href='two.php'">Click me</button> | |
//or | |
<button onclick='hello()'>Click me</button> | |
<script> | |
function hello(){ | |
//либо вызов скрипта прямо из JS | |
//document.write('<?php echo "Hi"; ?>'); | |
window.location.href='create.php'} | |
</script> | |
//Выдергиваем часть сайта | |
<?php | |
// сторонняя страница сайта, с которой будем брать контент. | |
$content = file_get_contents('https://polithelper.ru/map/'); | |
// определяем начало необходимого фрагмента кода, до которого мы удалим весь контент | |
$pos = strpos($content, '<div class="city">'); | |
// удаляем все до нужного фрагмента | |
$content = substr($content, $pos); | |
// находим конец необходимого фрагмента кода | |
$pos = strpos($content, '<footer class="footer border-top bg-light mt-auto py-3">'); | |
// отрезаем нужное количество символов от конца фрагмента | |
$content = substr($content, 0, $pos); | |
// выводим необходимый контент | |
echo $content; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment