I have an engine:

<?php include ('/core.php'); $page = (isset($_GET['page'])?$_GET['page']:'default'; switch ($page) { case ('register'): include ('/style/register.php'); break; default : include ('/style/index.php'); break; } ?> 

But no matter how I tried to configure it, the site does not work. Tell me, please, what to do. and also, the fact that the files are in style is all true!

  • 1. What does the site not find? What does not find? 2. include ('/core.php'); - this is not true, you need to write something like: include ($ _SERVER ['DOCUMENT_ROOT']. '/ core.php'); - Alex Kapustin
  • When I enter the site address, it writes: Internal site error - k0mar
  • @Prikol, And look at the log? When an "Internal Site Error" occurs, the server (apache2, for example) writes an error to the log file. - Nicolas Chabanovsky
  • I do not write. - k0mar
  • one
    Hammer on the sites. Take care design! - org

3 answers 3

 define('RD', dirname(__FILE__)); include (RD . '/core.php'); 

As an option.

    The question is not clear, but I will try:

    You have the line:

     include ('/core.php'); 

    As far as I know, this means the file should lie at the very root, meaning not the root of the site!)

    Try to fix it like this:

     include ('./core.php'); 

    With relative paths there is always confusion. Good luck.

      Why do you repeat your same question ???

      You need to write without errors:

       $page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : 'default'; 

      But there is no point in this line, because in switch the default handler will work anyway
      Therefore, I would write this:

       <?php include ('./core.php'); switch ( $_GET['page'] ) { case ('register'): include ('./style/register.php'); break; default: include ('./style/index.php'); } ?>