Integrer du php dans un portfolio avec filtre JS
Posté : 10 déc. 2011, 14:48
Bonjour à tous,
Voila j'aimerai intégrer du php dans un portfolio avec filtre qui fonctionne en js , html : http://net.tutsplus.com/tutorials/javas ... th-jquery/
Pour essayer de bien m'expliquer sous wamp j'ai une BBD nommé "gall" qui comprend 2 tables:
la premiere contient:
-reference
-photo
-titre (pas important ici)
-contenu (pas important ici)
-familleID (permet la liaison avec ma 2em table)
la deuxieme contient:
-ID
-intitule
ce qui me permet de classer mes photos en 3 categories :
Id=1 intitule=carpes
id=2 intitule=esturgeons
id=3 intitule=silures
Apres j'aimerai donc integrer un systeme de filtres selon ces 3 categories (ici il ya utilisation d'un plugin jquery)
JE vous laisse aussi le code entier de ma page test :
Donc si quelqu'un pourrait m'aider ou me donner une piste,
Merci énormement.
Voila j'aimerai intégrer du php dans un portfolio avec filtre qui fonctionne en js , html : http://net.tutsplus.com/tutorials/javas ... th-jquery/
Pour essayer de bien m'expliquer sous wamp j'ai une BBD nommé "gall" qui comprend 2 tables:
la premiere contient:
-reference
-photo
-titre (pas important ici)
-contenu (pas important ici)
-familleID (permet la liaison avec ma 2em table)
la deuxieme contient:
-ID
-intitule
ce qui me permet de classer mes photos en 3 categories :
Id=1 intitule=carpes
id=2 intitule=esturgeons
id=3 intitule=silures
Apres j'aimerai donc integrer un systeme de filtres selon ces 3 categories (ici il ya utilisation d'un plugin jquery)
<ul id="filter">
<li class="current"><a href="#">All</a></li>
<li><a href="#">carpes</a></li>
<li><a href="#">silures</a></li>
<li><a href="#">esturgeons</a></li>
</ul>
<ul id="portfolio">
<?php do { ?>
<li class="carpes"><a href="images/<?php echo $row_rsGallerie['photo']; ?>"> <img src="images/min/<?php echo $row_rsGallerie['photo']; ?>"/> </a></li>
<?php } while ($row_rsGallerie = mysql_fetch_assoc($rsGallerie)); ?>
</ul>
Mon code php est générer avec dreamweaver donc dès qu'il faut inserer du code manuellement, je suis completement perdu.JE vous laisse aussi le code entier de ma page test :
<?php require_once('Connections/connexionMysql.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_rsGallerie = 6;
$pageNum_rsGallerie = 0;
if (isset($_GET['pageNum_rsGallerie'])) {
$pageNum_rsGallerie = $_GET['pageNum_rsGallerie'];
}
$startRow_rsGallerie = $pageNum_rsGallerie * $maxRows_rsGallerie;
mysql_select_db($database_connexionMysql, $connexionMysql);
$query_rsGallerie = "SELECT gallerie.reference, gallerie.photo, gallerie.titre, gallerie.contenu, familles.intitule FROM gallerie, familles WHERE gallerie.familleID=familles.ID";
$query_limit_rsGallerie = sprintf("%s LIMIT %d, %d", $query_rsGallerie, $startRow_rsGallerie, $maxRows_rsGallerie);
$rsGallerie = mysql_query($query_limit_rsGallerie, $connexionMysql) or die(mysql_error());
$row_rsGallerie = mysql_fetch_assoc($rsGallerie);
if (isset($_GET['totalRows_rsGallerie'])) {
$totalRows_rsGallerie = $_GET['totalRows_rsGallerie'];
} else {
$all_rsGallerie = mysql_query($query_rsGallerie);
$totalRows_rsGallerie = mysql_num_rows($all_rsGallerie);
}
$totalPages_rsGallerie = ceil($totalRows_rsGallerie/$maxRows_rsGallerie)-1;
$queryString_rsGallerie = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsGallerie") == false &&
stristr($param, "totalRows_rsGallerie") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsGallerie = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsGallerie = sprintf("&totalRows_rsGallerie=%d%s", $totalRows_rsGallerie, $queryString_rsGallerie);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="stylesheets/screen.css" type="text/css" rel="stylesheet" media="screen,projection" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="framework.js"></script>
<title>Document sans titre</title>
</head>
<body>
<div id="container">
<ul id="filter">
<li class="current"><a href="#">All</a></li>
<li><a href="#">carpes</a></li>
<li><a href="#">silures</a></li>
<li><a href="#">esturgeons</a></li>
</ul>
<ul id="portfolio">
<?php do { ?>
<li class="<?php echo $row_rsGallerie['intitule']; ?>"><a href="images/<?php echo $row_rsGallerie['photo']; ?>"> <img src="images/min/<?php echo $row_rsGallerie['photo']; ?>"/> </a></li>
<?php } while ($row_rsGallerie = mysql_fetch_assoc($rsGallerie)); ?>
</ul>
</div>
</body>
</html>
<?php
mysql_free_result($rsGallerie);
?>
J'ai aussi trouver cela sur google : http://wordpress.org/support/topic/jquery-sort c'est une aide mais qui concerne l'integration dans wordpress (ce qui ne me concerne pas) mais je ne m'en sort pasDonc si quelqu'un pourrait m'aider ou me donner une piste,
Merci énormement.