Code komt niet in source code te staan
Op deze pagina worden via Json beoordelingen ingeladen maar ik in de html source code zie ik hier niets van terug, ik ben bang dat de zoekmachines deze beoordelingen dus niet indexeren omdat het niet in de source code te vinden is.
Hoe kan ik ervoor zorgen dat het wel in de source code te zien is? Dit is de code:
Code (php)
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
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
<?php [code]<?php
include './includes/functions/bedrijf-pagina/functies.php';
$items_per_page = 10; // aantal per pagina
$database = new database();
$q = ("SELECT * FROM beoordelingen WHERE domein_id = ".getCurrentDomeinIdByDomeinName($domein)." AND status = 1" );
$result = $database->query($q);
$total_records = mysqli_num_rows($result);
$total_pages = ceil($total_records/$items_per_page);
?>
<script>
$(document).ready(function()
{
var track_click = 0; //track user click on "load more" button, righ now it is 0 click
var total_pages = <?php echo $total_pages; ?>;
var domeinid = <?php echo $domeinId; ?>;
if (total_pages == 0)
{
$(".load_more").hide();
}
if(track_click >= total_pages-1) //compare user click with page number
{
//reached end of the page yet? disable load button
$(".load_more").attr("disabled", "disabled");
}
$('#results').load("../includes/autoloadscroller/autoload_process.php?val="+domeinid+"", {'page':track_click}, function() {track_click++;}); //initial data to load
$(".load_more").click(function (e) { //user clicks on button
$(this).hide(); //hide load more button on click
$('.animation_image').show(); //show loading image
if(track_click <= total_pages) //user click number is still less than total pages
{
//post page number and load returned data into result element
$.post('../includes/autoloadscroller/autoload_process.php?val='+domeinid+'',{'page': track_click}, function(data)
{
$(".load_more").show(); //bring back load more button
$("#results").append(data); //append data received from server
//scroll page smoothly to button id
$("html, body").animate({scrollTop: $("#load_more_button").offset().top}, 500);
//hide loading image
$('.animation_image').hide(); //hide loading image once data is received
track_click++; //user click increment on load button
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
alert(thrownError); //alert with HTTP error
$(".load_more").show(); //bring back load more button
$('.animation_image').hide(); //hide loading image once data is received
});
if(track_click >= total_pages-1) //compare user click with page number
{
//reached end of the page yet? disable load button
$(".load_more").attr("disabled", "disabled");
}
}
});
//alert(track_click);
});
</script>
<style>
.animation_image {background: #F9FFFF;border: 1px solid #E1FFFF;padding: 10px;width: 500px;margin-right: auto;margin-left: auto;}
</style>
<?php
echo $pagina;
?>
<div id="results"></div> ?>
include './includes/functions/bedrijf-pagina/functies.php';
$items_per_page = 10; // aantal per pagina
$database = new database();
$q = ("SELECT * FROM beoordelingen WHERE domein_id = ".getCurrentDomeinIdByDomeinName($domein)." AND status = 1" );
$result = $database->query($q);
$total_records = mysqli_num_rows($result);
$total_pages = ceil($total_records/$items_per_page);
?>
<script>
$(document).ready(function()
{
var track_click = 0; //track user click on "load more" button, righ now it is 0 click
var total_pages = <?php echo $total_pages; ?>;
var domeinid = <?php echo $domeinId; ?>;
if (total_pages == 0)
{
$(".load_more").hide();
}
if(track_click >= total_pages-1) //compare user click with page number
{
//reached end of the page yet? disable load button
$(".load_more").attr("disabled", "disabled");
}
$('#results').load("../includes/autoloadscroller/autoload_process.php?val="+domeinid+"", {'page':track_click}, function() {track_click++;}); //initial data to load
$(".load_more").click(function (e) { //user clicks on button
$(this).hide(); //hide load more button on click
$('.animation_image').show(); //show loading image
if(track_click <= total_pages) //user click number is still less than total pages
{
//post page number and load returned data into result element
$.post('../includes/autoloadscroller/autoload_process.php?val='+domeinid+'',{'page': track_click}, function(data)
{
$(".load_more").show(); //bring back load more button
$("#results").append(data); //append data received from server
//scroll page smoothly to button id
$("html, body").animate({scrollTop: $("#load_more_button").offset().top}, 500);
//hide loading image
$('.animation_image').hide(); //hide loading image once data is received
track_click++; //user click increment on load button
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
alert(thrownError); //alert with HTTP error
$(".load_more").show(); //bring back load more button
$('.animation_image').hide(); //hide loading image once data is received
});
if(track_click >= total_pages-1) //compare user click with page number
{
//reached end of the page yet? disable load button
$(".load_more").attr("disabled", "disabled");
}
}
});
//alert(track_click);
});
</script>
<style>
.animation_image {background: #F9FFFF;border: 1px solid #E1FFFF;padding: 10px;width: 500px;margin-right: auto;margin-left: auto;}
</style>
<?php
echo $pagina;
?>
<div id="results"></div> ?>
En dat klopt, ten dele. In veel gevallen zal dat door Google (en andere zoekmachines) niet worden geindexeerd. Daar kan je wel voor zorgen als je enig extra werk erin stopt. Hier een uitleg hoe Google het mogelijk maakt:
https://developers.google.com/webmasters/ajax-crawling/
Waar komt $pagina vandaan?
- Aar - op 19/06/2014 14:31:01:
Waar komt $pagina vandaan?
$pagina komt uit het functie bestand die bovenin wordt geinclude, maar heeft geen invloed om het probleem. $pagina is alles behalve de beoordelingen.
Is het misschien ook een optie om de eerste 25 beoordelingen gewoon via php op te halen en te weergeven en dan via Ajax de rest via de load more button dat die dan start vanaf 25? Of zal dit lastig worden?
Gewijzigd op 19/06/2014 14:44:16 door Furio Scripting