ARTICLE AD BOX
this is my very first code and I’m just a student trying to learn and improve step by step. I know I still have a lot to learn, but I’m doing my best to understand how everything works and get better every day.
I’d really appreciate any feedback, advice, or tips that could help me grow as a programmer. Please be kind — I’m still at the beginning of my journey
css
* { font-family: "Josefin Sans", sans-serif; background-color: lightcoral; color: black; } header ul { display: flex; justify-content: center; gap: 20px; } li, a { text-decoration: none; list-style: none; } .obrazky { text-align: center; justify-content: center; display: flex; } .active { color: yellowgreen; } .info { color: red; padding: 10px; border-left: 5px solid yellowgreen; font-weight: bold; } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>First Code</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <header> <ul> <?php $zdroj = "./images"; $priečinky = array_diff(scandir($zdroj), ['.', '..']); $volba = $_GET['id'] ?? null; foreach ($priečinky as $kat) { $styl = ($volba == $kat) ? "active" : ""; $meno = ucfirst(str_replace(['-', '_'], ' ', $kat)); echo "<li><a class='$styl' href='?id=$kat'>$meno</a></li>"; } ?> </ul> </header> <?php if ($volba) { $cesta = "images/$volba"; $subory = array_diff(scandir($cesta), ['.', '..']); $pocet = count($subory); function zlava($cena, $percenta) { return $cena - ($cena * ($percenta / 100)); } $nova_cena = zlava(100, 20); echo "<div class='info'>"; echo "Položiek: $pocet "; echo "<br>"; echo "cena: $nova_cena €"; echo "</div>"; foreach ($subory as $foto) { $cista_cesta = "$cesta/$foto"; $nazov = str_replace(['-', '_'], ' ', pathinfo($foto, PATHINFO_FILENAME)); echo "<div style='display:inline-block; margin:10px;'>"; echo "<a href='$cista_cesta' target='_blank'><img src='$cista_cesta' width='100'></a> class"; echo "<br>$nazov"; echo "</div>"; } } ?> </body> </html>