mirror of
https://github.com/FranP-code/Allnews.com.git
synced 2025-10-13 00:32:45 +00:00
Modificadas las funciones del backend, y ajustado el tamaño de los videos embebidos en la noticia
This commit is contained in:
@@ -1 +1 @@
|
||||
15
|
||||
19
|
||||
@@ -1 +1 @@
|
||||
./news/1.html ./news/2.html ./news/3.html ./news/4.html ./news/5.html ./news/6.html ./news/7.html ./news/8.html ./news/9.html ./news/10.html ./news/11.html ./news/12.html ./news/13.html ./news/14.html ./news/15.html
|
||||
./news/1.html ./news/2.html ./news/3.html ./news/4.html ./news/5.html ./news/6.html ./news/7.html ./news/8.html ./news/9.html ./news/10.html ./news/11.html ./news/12.html ./news/13.html ./news/14.html ./news/15.html ./news/16.html ./news/17.html ./news/18.html ./news/19.html
|
||||
8
news.css
8
news.css
@@ -97,4 +97,12 @@ article {
|
||||
figcaption {
|
||||
color: #797979;
|
||||
margin-bottom: 3vh;
|
||||
}
|
||||
|
||||
iframe {
|
||||
/*! RELACIÓN 16:9 ENTRE ANCHO Y ALTO, EL CONTENIDO TIENE 56 VW DE ANCHO. POR LO TANTO, EL ALTO DEBE SER DE 32 VW PARA QUE EL VIDEO EMBEBIDO TENGA EL TAMAÑO ADECUADO PARA EL RATO 16:9*/
|
||||
|
||||
width: 100% !important;
|
||||
height: 32vw !important;
|
||||
border: none;
|
||||
}
|
||||
1
news.php
1
news.php
@@ -5,6 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="news.css">
|
||||
<link rel="icon" href="./img/logo.svg">
|
||||
<title>
|
||||
<?php
|
||||
require 'news_logic.php';
|
||||
|
||||
@@ -19,7 +19,8 @@ function check_news($news_per_page, $mySQLconnectRoute) {
|
||||
|
||||
$page = know_page($news_unique);
|
||||
$author = know_author($page, $news_unique);
|
||||
create_entry_in_DB($news_unique, $page, $author, $mySQLconnectRoute);
|
||||
$page_data = get_contents($news_unique, $page, $author);
|
||||
create_entry_in_DB($mySQLconnectRoute, $page_data, $news_unique);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +93,7 @@ function get_string_between($string, $start, $end){
|
||||
//! CREDITS: https://stackoverflow.com/a/9826656
|
||||
}
|
||||
|
||||
function create_entry_in_DB($news_unique, $page, $author, $mySQLconnectRoute) {
|
||||
require $mySQLconnectRoute;
|
||||
function get_contents($news_unique, $page, $author) {
|
||||
$content = file_get_contents($news_unique);
|
||||
|
||||
switch ($page) {
|
||||
@@ -135,10 +135,32 @@ function create_entry_in_DB($news_unique, $page, $author, $mySQLconnectRoute) {
|
||||
break;
|
||||
}
|
||||
|
||||
$title;
|
||||
$icon;
|
||||
$inner_HTML;
|
||||
$frist_p;
|
||||
return [
|
||||
'title' => $title,
|
||||
'inner_HTML' => $inner_HTML,
|
||||
'icon' => $icon,
|
||||
'page_source' => $page,
|
||||
'author' => $author,
|
||||
'frist_p' => $frist_p
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
function create_entry_in_DB($mySQLconnectRoute, $page_data, $news_unique) {
|
||||
require $mySQLconnectRoute;
|
||||
|
||||
//* ASIGNACIÓN DE VARIABLES
|
||||
|
||||
$title = $page_data['title'];
|
||||
$inner_HTML = $page_data['inner_HTML'];
|
||||
|
||||
$icon = $page_data['icon'];
|
||||
$page = $page_data['page_source'];
|
||||
|
||||
$author = $page_data['author'];
|
||||
$frist_p = $page_data['frist_p'];
|
||||
|
||||
//* QUERY A LA DB
|
||||
|
||||
$insert_news = $mySQLconnect -> prepare('insert into noticias (title, content, icon_route, page_source, author, frist_paragraph) values (?, ?, ?, ?, ?, ?)');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user