Jump to content
php.lv forumi

Skripts kas aizstāj bildi


*jancis38*

Recommended Posts

Sintakses errorus nemet? Jo tādiem tev tu pilns.

<?php
$map = "img/mapes/{map}.jpg";
$bilde = is_file($map) ? $map : "img/off.jpg";
echo "<img src=\"".$bilde."\" alt=\"bilde\" />";
?>

Bet nez ko tas {map} dara. Kas tas vispār tāds ir?

Link to comment
Share on other sites

<?php

$bilde = file_exists('img/mapes/{map}.jpg' ) ? 'img/mapes/{map}.jpg' : 'img/off.jpg';

echo '<img src="', $bilde, '" alt="bilde" /.">';

?>

 

trūka "> beigās aiz [<img src="', $bilde, '" alt="bilde" /.]

Edited by ray
Link to comment
Share on other sites

×
×
  • Create New...