I'm transferring my website from a server that was hosted locally to a actual webhost. But our php script that is supposed to load small html documents doesn't work now.
I've tried contacting the webhost support, but they couldn't really help me. I've tried different paths to the script or folder with the html documents. I've tried setting all the scripts and folders to use '755' I've tried different browsers.
newspage.php is located in the same folder as index.php where newspage.php is called from.
index.php
<div class="content" >
<?php include_once ('newspage.php'); ?>
</div>
'Nieuws' is the folder with the html documents in it, they are titled 1 to 5.
Here is one as an example
1.html
<div id="news-module">
<header>
<div id="spawn4" class="resize">
Vaderdag 2018
</div>
<p class="no-text-shadow">11-12-17</p>
</header>
<div id="news4" aria-expanded="false">
<p class="news">Vooraf via Pin betalen.<br> Geldig vanaf vandaag t.m 18 juni 2018</p>
<div>
<img src="/images/nieuws/Image1527534901002.jpg" style="height: 100%; width: 100%; object-fit: contain;" alt="Vaderdag" title="">
</div>
</div>
</div>
newspage.php
<?php
$selectedindex = 0;
if(isset($_REQUEST['newsitem'])){
$selectedindex = $_REQUEST['newsitem'];
}
# $goedepath = "/var/www/html/Hielo-website/Nieuws"; #
$goedepath = "Nieuws";
$txt = explode("
",shell_exec("ls -r -a -1 $goedepath "));
$ttip = 0;
$maxheight = "285px";
echo "
<div style='position: relative;'>
<button class='button date alt' style='margin-bottom:5px; font-size:25px; line-height:25px;' onclick='alpha()' id='vorige'><i class='fa fa-angle-left'></i></button>
<button style='position: absolute; right: 0px; font-size:25px; line-height:25px;' class='button date alt' onclick='beta()' id='volgende'><i class='fa fa-angle-right'></i></button>
</div>";
foreach($txt as $bestand){
$tty = "$goedepath/$bestand";
if(file_exists($tty)){
echo "<div id='dx$ttip' style='display: none; min-height: $maxheight; max-height: $maxheight;'>" . file_get_contents($tty) . "</div>";
$ttip = $ttip + 1;
}
}
echo "
<button onclick='toggleMoreOrLess()' class='expandnewsbutton' id='readmorebutton' style='display: none'>Lees meer</button>
<div id='emptynewsspace' style='display: block; height: 51px; width: auto;'></div>
<script>
function toggleMoreOrLess(){
var element = document.getElementById('dx'+XxX);
var gevraagd = element.scrollHeight+'px';
var minimaal = '$maxheight';
if(element.style.maxHeight==minimaal){
element.style.maxHeight = gevraagd;
readmorebutton.innerHTML = 'Lees minder';
}else{
element.style.maxHeight = minimaal;
readmorebutton.innerHTML = 'Lees meer';
}
}
var XxX = 0;
function alpha(){
resetStatement();
XxX--;
gamma();
}
function beta(){
resetStatement();
XxX++;
gamma();
}
function resetStatement(){
var minimaal = '$maxheight';
var actueelActiefDocument = document.getElementById('dx'+XxX);
actueelActiefDocument.style.maxHeight = minimaal;
readmorebutton.innerHTML = 'Lees meer';
}
function gamma(){
for(var i = 0 ; i < $ttip ; i++){
document.getElementById('dx'+i).style.display = 'none';
}
var element = document.getElementById('dx'+XxX);
element.style.display = 'block';
element.style.overflow = 'hidden';
if (element.offsetHeight < element.scrollHeight ||
element.offsetWidth < element.scrollWidth) {
// your element have overflow
readmorebutton.style.display = 'block';
emptynewsspace.style.display = 'none';
} else {
// your element doesn't have overflow
readmorebutton.style.display = 'none';
emptynewsspace.style.display = 'block';
}
vorige.disabled = XxX==0;
volgende.disabled = XxX==($ttip-4);
}
window.addEventListener('load', function(){gamma()}, false );
</script>
";
?>
It's supposed to load the html documents and display them one at a time. Whereas if you hit the prev/next button it will display the previous or next document.
What actually happens is that it doesn't show any of the files. And if i inspect it, its showing me this:
<div style="position: relative;">
<button class="button date alt" style="margin-bottom:5px; font-size:25px; line-height:25px;" onclick="alpha()" id="vorige" disabled=""><i class="fa fa-angle-left"></i></button>
<button style="position: absolute; right: 0px; font-size:25px; line-height:25px;" class="button date alt" onclick="beta()" id="volgende"><i class="fa fa-angle-right"></i></button>
</div>
<div id="dx0" style="display: block; min-height: 285px; max-height: 285px; overflow: hidden;"></div>
<button onclick="toggleMoreOrLess()" class="expandnewsbutton" id="readmorebutton" style="display: none">Lees meer</button>
<div id="emptynewsspace" style="display: block; height: 51px; width: auto;"></div>