0

so I am having a bit of a problem here with editing my web project. This is my main.php: which is located in /final/public/main.php

<?php

   $path = $_SERVER['DOCUMENT_ROOT'];
   $path .= "/projects/final/includes/config.php";
   include($path);


render("main_display.php");

?>
hello

Config.php looks like this:

<?php
    /**
     * config.php
     * Configures pages.
     */
    // display errors, warnings, and notices
    ini_set("display_errors", true);
    error_reporting(E_ALL);
    // requirements
    require("functions.php");

    // enable sessions
    session_start();

?>

function.php is in the same folder as config.php, and I stole render from CS50 pset7. and render works, get an output of this:

 hello, this is my blog

This is where I would put my writing

maybe a comments section?

Thats it.
hello

As per main_display.php in /final/templates/main_display.php But if i change main_display.php to something else, like this

<p>
    hello, th blog
</p>

<p>
    This is where I would put my writing
</p>

<p>
    maybe a comments section?
</p>

<p>
    Maybe I should have a link to some php that does recursion you
    already had?
</p>

the output STAYS THE SAME:

 hello, this is my blog

This is where I would put my writing

maybe a comments section?

Thats it.
hello

How is this even possible??? Help me

1

I fought with a similar pathing problem and it turned out that $_SERVER['DOCUMENT_ROOT'] was the cause. It is set in the apache configuration which might not be totally clear from the php doc.

'DOCUMENT_ROOT'

The document root directory under which the current script is >executing, as defined in the server's configuration file.

On the appliance,it has a value of /var/www. You can google around for 100's of different php solutions. I based my path on dirname(__FILE__) in my home page.

1
  • Thanks for the help, by doing this I figured out my mistake. – Fijj01 Nov 18 '15 at 0:11
1

Uh here is my problem. I had main_display.php in my public folder, which I was messing around with. But I also had a main_display.php in my template folder, which i never changed and that was what was being displayed. I feel like a total idiot lol...

0

@Fijj01: Glad you figured it out! Be sure to approve an answer by clicking the green check mark, even if it's your own answer! Only you can do this, and it's the only way to prevent this from forever haunting the forum as a zombie unanswered question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .