i'm working on an old code(2006) that creates a table in php with ... to do a photo gallery. In this code, there is a php variable to define the number of columns that will be displayed on the page (this variable is defined by the user from the UI). I need to get this page responsive and I want that variable to be 3 on small device to display 3 columns.
I was thinking to use a matchMedia() to change the variable te 3 on small device but I don't know if it's possible to change a php variable from a JS function.
Maybe it isn't the best solution but I can't think of another way.
Here's a part of the code that creates the table :
$arrayDesPhotos = array();
if (isset($cart->article)) {
foreach($cart->article as $article => $contenu){
$arrayDesPhotos[] = round($article,0);
}
}
$fin = ($deb*$nombre_total_photos_par_page);
$nbr_files = count($filelistVignettes["links"]);
$navig = "";
if($nbr_files > $nombre_total_photos_par_page) {
$paginationNbr = ceil($nbr_files/$nombre_total_photos_par_page);
$navig.="<table style='width:885px' ><tr><td style='text-align:right;padding-right:10px;'>";
if($deb > 1) $navig.="<img onclick='javascript:changePage(".($deb-1).");' src='images/previous.gif' style='cursor:pointer;'></img>";
$navig.="</td><td style='text-align:center;font-family:arial,verdana, sans;font-size:13px;font-weight:bold'>";
for($p=0; $p < $paginationNbr; $p++){
if(($p+1) == $deb) $styleNumber="color:#ff0000;font-weight:bold;text-decoration:none";
else $styleNumber="normal";
$navig.="<a class='num-page'href='javascript:changePage(".($p+1).");' style='color:#000000;padding-left:5px;font-weight:normal;".$styleNumber."' href='' >".($p+1)."</a>";
if($p == 34 ) $navig.="<br/>";
}
$navig.="</td><td style='text-align:left;padding-left:10px;'>";
if($deb < $paginationNbr) $navig.="<img onclick='javascript:changePage(".($deb+1).");' src='images/next.gif' style='cursor:pointer;'></img>";
$navig.="</td></tr></table>";
}
echo "<table cellpadding=0 cellspacing=0 class='tableGalerie'>";
echo "<tr><td class='titleGalerie' colspan='".$nombre_de_photos_par_ligne."'>";
if ($_SESSION["directory"] == "eglisesaintelisabeth") {
echo '<span id="labelTeteDeGalerie" style="margin-right:12px;">Récupération des photos le Dimanche 28 Juin, au 28 rue Jean Mermoz</span>';
echo '<span id="labelTeteDeGalerie" style="margin-right:12px;">(1 Photo 10€ / dès 6 Photos, 8€ / dès 10 photos, 6€)</span>';
}
else {
echo $_SESSION["titleBook"];
}
echo "</td></tr>";
echo "<tr><td colspan='".$nombre_de_photos_par_ligne."'>" .
$navig
."</td></tr>";
Aucun commentaire:
Enregistrer un commentaire