脚本无法找到或执行文件夹文件

时间:2019-01-28 10:37:38

标签: php html

我正在将我的网站从本地托管的服务器转移到实际的虚拟主机。但是我们应该加载小的html文档的php脚本现在无法正常工作。

我曾尝试与网络托管支持人员联系,但他们并不能真正帮助我。 我尝试了使用html文档的脚本或文件夹的不同路径。 我尝试将所有脚本和文件夹设置为使用“ 755” 我尝试了其他浏览器。

newspage.php与调用newspage.php的index.php位于同一文件夹中。

index.php

<div class="content" >
  <?php include_once ('newspage.php'); ?>
</div>

“ Nieuws”是其中包含html文档的文件夹,标题为1到5。

这里有一个例子

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("\n",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>

";
?>

应该加载html文档并一次显示一个。而如果您按下上一个/下一个按钮,它将显示上一个或下一个文档。

实际上发生的是它没有显示任何文件。如果我检查它,它会向我显示以下内容:

<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>

0 个答案:

没有答案