Bonjour j'essaie en vain de mettre dans une pagination d'articles un lien dans chaque article envoyant ouvrant une iframe grâce à fancybox.

Le lien fonctionne très bien dans mon code principal (pour le tester) mais une fois dans les articles, rien ne va plus, cela ouvre bien la page mais pas en fancybox

page : index-test.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<!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" xml:lang="en" lang="en">
<head>
<title><?php echo $titre." - ".constant("SITEDESC".$languepage); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Lull Agency, site internet à Dijon" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="shortcut icon" type="image/x-icon" href="../css/dropdown/themes/vimeo.com/images/favicon.ico" />
<link href="../css/dropdown/themes/vimeo.com/helper.css" media="screen" rel="stylesheet" type="text/css" />
<!-- Beginning of compulsory code below -->
<link href="../css/dropdown/dropdown.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../css/dropdown/themes/vimeo.com/default.advanced.css" media="screen" rel="stylesheet" type="text/css" />
<link href="../css/style<?php echo $languepage; ?>.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
	<script>
		!window.jQuery && document.write('<script src="../js/jquery-1.4.3.min.js"><\/script>');
	</script>
<link rel="stylesheet" href="../css/load_posts.css" type="text/css" media="screen" />
 
<script type="text/javascript">
            $(document).ready(function(){
                function loading_show(){
                    $('#loading').html("<img src='../css/images/loading.gif'/>").fadeIn('fast');
                }
                function loading_hide(){
                    $('#loading').fadeOut('fast');
                }                
                function loadData(page){
                    loading_show();                    
                    $.ajax
                    ({
                        type: "POST",
                        url: "data_posts.php",
                        data: "page="+page,
                        success: function(msg)
                        {
                            $("#container").ajaxComplete(function(event, request, settings)
                            {
                                loading_hide();
                                $("#container").html(msg);
                            });
                        }
                    });
                }
                loadData(1);  // For first time page load default results
                $('#container .pagination li.active').live('click',function(){
                    var page = $(this).attr('p');
                    loadData(page);
 
                });           
                $('#go_btn').live('click',function(){
                    var page = parseInt($('.goto').val());
                    var no_of_pages = parseInt($('.total').attr('a'));
                    if(page != 0 && page <= no_of_pages){
                        loadData(page);
                    }else{
                        alert('Enter a PAGE between 1 and '+no_of_pages);
                        $('.goto').val("").focus();
                        return false;
                    }
 
                });
            });
        </script>
<script type="text/javascript" src="../fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="../fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="../fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
		$(document).ready(function() {
 
			/*
			*   Examples - various
			*/
 
			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
 
			$("#various2").fancybox();
 
			$("#various3").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});
 
			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
	</script>
<!--[if lte IE 7]>
<script type="text/javascript" src="../js/jquery/jquery.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.dropdown.js"></script>
<![endif]-->
<!-- / END -->
 
</head>
<body>
<div id="loading"></div>
<div id="container">
<div class="data"></div>
<div class="pagination"></div>
</div>
les div data et pagination sont remplis par la page data_posts.php qui est appelé dans la fonction load_data ci-dessus (en début de script)

et voici la page data_posts

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
 
$page = $_POST['page'];
$cur_page = $page;
$page -= 1;
$per_page = 2;
$previous_btn = true;
$next_btn = true;
$first_btn = true;
$last_btn = true;
$start = $page * $per_page;
 
if(!isset($_GET['id'])OR !is_numeric($_GET['id'])){ $idpage=HOMEDEFAULT; }
else{$idpage=$_GET['id'];}
 
///////////////////////////////////////POSTS//////////////////////////////////////////////////////
 
///////////////////////////////////////SELECT CONTENU POST////////////////////////////////////
 
$sqlposts = "SELECT * FROM posts  WHERE idrub=".$idpage." AND languepost='".$languepage."' ORDER BY ordre ASC, date DESC LIMIT ".$start.", ".$per_page."";
$sthposts = $dbh->query($sqlposts);
$posts = $sthposts->fetchAll();
$nbreposts = count($posts);
 
////si pas de resultat dans cette langue on cherche dans la langue par défault//
if($nbreposts==0){	
	$sqlposts = "SELECT * FROM posts, langues  WHERE langues.langues=posts.languepost AND posts.idrub=".$idpage." AND langues.statut=0 ORDER BY posts.ordre ASC, posts.date DESC LIMIT ".$start.", ".$per_page."";
	$sthposts = $dbh->query($sqlposts);
	$posts = $sthposts->fetchAll();
	$nbreposts = count($posts);
}
 
 
////////////////////////pour pagination count/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$sqlposts2 = "SELECT * FROM posts  WHERE idrub=".$idpage." AND languepost='".$languepage."' ORDER BY ordre ASC, date DESC";
$sthposts2 = $dbh->query($sqlposts2);
$posts2 = $sthposts2->fetchAll();
}
$count = count($posts2);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
 
<?php
if($nbreposts>0){
	$msg="";
	?>
	<div id="posts">
	<?php
 
	foreach($posts as $row){
	//variables//
										    if($row['photo']!=""){$photoposts="..".$row['photo'];}
										$contenuposts=htmlspecialchars_decode($row['contenu']);
										$titreposts=htmlspecialchars_decode($row['titre']);
										$bonnedate=Datedanslordre($row['date']);
///////////
													?>
													<div class="posts1">
														<div class="bloctitreposts">
															<span class="titreposts">
																<?php $titreposts=raccourcirChaine($titreposts, MAXTITREPOSTS);
                                                                                                                                echo $titreposts; ?>
															</span>
															<p class="dateposts"><?php echo DATEPOSTMSG." ".$bonnedate; ?></p>
														</div>
														<div class="contenuposts">
															<?php 
															if($photoposts!=""){ ?>
															<img class="photoposts" src="<?php echo $photoposts; ?>" ?> />
															<?php 
                                                                                                                        } 
                                                                                                                        $contenuposts2=raccourcirChaine($contenuposts, MAXDESCRIPTIONPOSTS);
 
//////////////// Ce lien la ne marche pas et si je le note tel quel dans le
///////////////  fichier index-test.php ca marche je ne comprends vraiment pas
echo "<a id='various3' href='posts.php?id=".$row['id']."'>".$contenuposts2."</a>";
                                                                                                                        ?>
														</div>
													</div>
<?php
        }
 
                                                                        
/////////calcul des pages CELA FONCTIONNE////////
 
 
$no_of_paginations = ceil($count / $per_page);
 
/* ---------------Calculating the starting and endign values for the loop----------------------------------- */
if ($cur_page >= 7) {
    $start_loop = $cur_page - 3;
    if ($no_of_paginations > $cur_page + 3)
        $end_loop = $cur_page + 3;
    else if ($cur_page <= $no_of_paginations && $cur_page > $no_of_paginations - 6) {
        $start_loop = $no_of_paginations - 6;
        $end_loop = $no_of_paginations;
    } else {
        $end_loop = $no_of_paginations;
    }
} else {
    $start_loop = 1;
    if ($no_of_paginations > 7)
        $end_loop = 7;
    else
        $end_loop = $no_of_paginations;
}
/* ----------------------------------------------------------------------------------------------------------- */
$msg .= "<div class='pagination'><ul>";
 
// FOR ENABLING THE FIRST BUTTON
if ($first_btn && $cur_page > 1) {
    $msg .= "<li p='1' class='active'>First</li>";
} else if ($first_btn) {
    $msg .= "<li p='1' class='inactive'>First</li>";
}
 
// FOR ENABLING THE PREVIOUS BUTTON
if ($previous_btn && $cur_page > 1) {
    $pre = $cur_page - 1;
    $msg .= "<li p='$pre' class='active'>Previous</li>";
} else if ($previous_btn) {
    $msg .= "<li class='inactive'>Previous</li>";
}
for ($i = $start_loop; $i <= $end_loop; $i++) {
 
    if ($cur_page == $i)
        $msg .= "<li p='$i' style='color:#fff;background-color:#006699;' class='active'>{$i}</li>";
    else
        $msg .= "<li p='$i' class='active'>{$i}</li>";
}
 
// TO ENABLE THE NEXT BUTTON
if ($next_btn && $cur_page < $no_of_paginations) {
    $nex = $cur_page + 1;
    $msg .= "<li p='$nex' class='active'>Next</li>";
} else if ($next_btn) {
    $msg .= "<li class='inactive'>Next</li>";
}
 
// TO ENABLE THE END BUTTON
if ($last_btn && $cur_page < $no_of_paginations) {
    $msg .= "<li p='$no_of_paginations' class='active'>Last</li>";
} else if ($last_btn) {
    $msg .= "<li p='$no_of_paginations' class='inactive'>Last</li>";
}
$goto = "<input type='text' class='goto' size='1' style='margin-top:-1px;margin-left:60px;'/><input type='button' id='go_btn' class='go_button' value='Go'/>";
$total_string = "<span class='total' a='$no_of_paginations'>Page <b>" . $cur_page . "</b> of <b>$no_of_paginations</b></span>";
$msg = $msg . "</ul>" . $goto . $total_string . "</div>";  // Content for pagination
echo $msg;
}
?>
Voila si quelqu'un peut m'aider