C9 Workspace URL slow/failure to update files and domain breaks php files


#1

I don’t know if it’s happening to everyone or if it’s just me, but I’ve been trying to make a webpage using cloud9 as my workspace. Lately, CSS files have been EXTREMELY slow, if they even do, update. Not only that, but when I go to workspace-thegaminghideout.c9.io, my menu php doesn’t work. It doesn’t load or properly include the nav menu. But if I go to workspace-thegaminghideout.c9.io/index.php, it works properly. With my .htaccess redirecting home to index.php, that breaks the menu as well. Keep in mind that it was doing this before I even added a .htaccess file. Here’s my code; is it something on my end or C9’s end?

<html>
<head>
 <?php include 'include/header.php'; ?>
</head>
<body>
<div id='container'>
    <div  id='header'>
        <?php include 'include/menu.php'; ?>
    </div>
    <div id='body'>
        <p>test</p>
    </div>
    <div id='footer'>
        <h5>test</h5>
    </div>
</div>
</body>
</html>

menu.php

<?php 
    $strhtml = '<ul>
                    <li><a id="home" href="index.php">Home</a></li>
                    <li><a id="games" href="games.php">Games</a></li>
                    <li><a id="news" href="news.php">News</a></li>
                    <li><a id="projects" href="projects.php">Projects</a></li>
                    <li><a id="about" href="about.php">About</a></li>
                </ul>';
    $dochtml = new DOMDocument();
    $dochtml->loadHTML($strhtml, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
    //get the file name
    $directoryURI = $_SERVER['REQUEST_URI'];
    $path = parse_url($directoryURI, PHP_URL_PATH);
    $components = explode('/', $path);
    $first_part = $components[1];
    //iterate through pages for active element
    switch($first_part) {
        case "index.php":
            $dochtml->getElementById("home")->setAttribute("class", "active");
            echo $dochtml->saveHTML();
            break;
        case "games.php":
            $dochtml->getElementById("games")->setAttribute("class", "active");
            echo $dochtml->saveHTML();
            break;
        case "news.php":
            $dochtml->getElementById("news")->setAttribute("class", "active");
            echo $dochtml->saveHTML();
            break;
        case "projects.php":
            $dochtml->getElementById("projects")->setAttribute("class", "active");
            echo $dochtml->saveHTML();
            break;
        case "about.php":
            $dochtml->getElementById("about")->setAttribute("class", "active");
            echo $dochtml->saveHTML();
            break;
    }
?>

.header php (since its apart of index.php)

<?php 
    $title = ucfirst(basename($_SERVER['PHP_SELF'], ".php"));
    $strhtml = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <!--=== LINK TAGS ===-->
        <link rel="shortcut icon" href="css/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
        <!--=== TITLE ===-->  
        <title></title>';
        
    $doc = new DOMDocument();
    $doc->loadHTML($strhtml);
    
    $doc->getElementsByTagName("title")->item(0)->nodeValue = $title;
    echo $doc->saveHTML();
?>

.htaccess

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^home/?$    index.php    [NC,L]    # Handle requests for "home"