[AJAX] Ajax Php WordPress - Challenge!
Bonjour,
j'essaie en vain jusqu'à présent de convertir un code html/ajax dans un thème Wordpress. :(
Voici ma méthode et le code utilisé:
Le code:
ici: http://tympanus.net/codrops/2010/05/...th-jquery-php/
La partie modifiée pour obtenir un autoscroll:
Même adresse, dans les commentaires Bali June 13th, 2011 at 14:46
Le script jquery.gallery.js appel ligne 75 le script AJAX: buildThumbs();
Dans wordpress j'ai créé une page à laquelle j'applique une page modèle page-fullscreen.php qui reprend le code html:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
| <?php
/**
*
* Template Name: Full Screen
*
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<?php
/********************************************************************************************* Fusion/digitalnature *************/
if(get_option('fusion_meta')<>'') {
if (is_home()) {
$metakeywords = get_option('fusion_meta');
} else if (is_single()) {
$metakeywords = "";
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$metakeywords = $metakeywords . $tag->name . ", ";
}
}
}
?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php // language_attributes('xhtml'); // -> generates invalid markup :( ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<?php if($metakeywords<>'') { ?>
<meta name="keywords" content="<?php echo $metakeywords; ?>" />
<meta name="description" content="<?php bloginfo('description'); ?>" />
<?php } ?>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
<!-- The JavaScript-->
<script type="text/javascript" src="http://localhost/blog/wp-content/themes/fusion4/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/blog/wp-content/themes/fusion4/jquery.gallery.js"></script>
<script type="text/javascript" src="http://localhost/blog/wp-content/themes/fusion4/jquery.easing.1.3.js"></script>
<?php
if(!defined("PHP_EOL")) define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");
print '<style type="text/css" media="all">'.PHP_EOL;
print '@import "'.get_bloginfo('stylesheet_url').'";'.PHP_EOL;
if(get_option('fusion_sidebarpos')=='left')
print '@import "'.get_bloginfo('template_url').'/options/leftsidebar.css";'.PHP_EOL;
if(get_option('fusion_header')=='user') {
if(get_option('fusion_headerimage')<>'')
print '#page-wrap2{ background: transparent url("'.get_option('fusion_headerimage').'") no-repeat center top; }'.PHP_EOL;
if(get_option('fusion_headerimage2')<>'')
print '#page-wrap1{ background: transparent url("'.get_option('fusion_headerimage2').'") repeat-x center top; }'.PHP_EOL;
}
else if(get_option('fusion_header')=='user2') {
print '#page-wrap2{ background: #'.get_option('fusion_headercolor').'; }'.PHP_EOL;
print '#page-wrap1{ background: none; }'.PHP_EOL;
}
$usercss = get_option('fusion_css');
if($usercss<>'') print $usercss;
print '</style>'.PHP_EOL;
?>
</head>
<body>
<div class="albumbar">
<span>
<a href="http://www.cogerino.com/" target="_blank">
Bali Cogerino's book
</a>
</span>
<div id="albumSelect" class="albumSelect">
<ul>
<?php
$firstAlbum = '';
$i=0;
if(file_exists('images2')) {
$files = array_slice(scandir('images2'), 2);
if(count($files)) {
natcasesort($files);
foreach($files as $file) {
if($file != '.' && $file != '..') {
if($i===0)
$firstAlbum = $file;
else
echo "<li><a>$file</a></li>";
++$i;
}
}
}
}
?>
</ul>
<div class="title down"><?php echo $firstAlbum;?></div>
</div>
</div>
<div id="preview">
<div class="fp_overlay"></div>
<div id="imageWrapper">
</div>
<!-- <div id="loading"></div> -->
<div id="fp_next" class="fp_next"></div>
<div id="fp_prev" class="fp_prev"></div>
</div>
<div id="thumbsWrapper">
</div>
<div class="infobar">
<span id="description"></span>
<span class="reference">
<a href="http://localhost/blog/">©cogerinoblog</a>
</span>
</div>
</body>
</html> |
et celà ne fonctionne pas: Le code se lance bien mais on dirait que la variable Album censé être récupérée dans thumbs.php par l'expression $album = $_GET['album']; arrive vide.
Si quelqu'un peut me donner une piste; je suis un peu bloqué et ne sais pas comment tester la valeur pour savoir si elle arrive vide ou non.
Merci pour toute aide. :)