Site with backslash on localhost

0

I downloaded the site from the server and put it to run on localhost. However, it is not calling the files correctly. First, it calls " link " and then the folder path, with backslash.

Thereisarulesettocallallfiles:

<?phpdefine("MY_BASE_DIR", 'C:');
define("SITE_PATH", __DIR__ . '/');
define("SITE_VIRTUAL_DIR", str_replace($_SERVER["DOCUMENT_ROOT"], "", SITE_PATH));
define("ENGINE_PATH", SITE_PATH.'includes/fw/'); // caminho pro FW
define("CMS_ENGINE_PATH", SITE_PATH.'includes/cms/cms.php');

I tried to change this rule, but without success.

This backslash configuration is some snippet in the code files that have either been modified or is my local server configuration (I'm using WampServer)?

----------------------------- UPDATE -------------- ----------------

This is the file that gives way to the files:

public function Setup()
{
    parent::Setup();

    if (\Browser::Obsolet())
    {
        $this->context->UpdateYourBrowser();
    }

    if(!defined("ADMIN_DIR")){
        define("ADMIN_DIR", dirname($_SERVER["SCRIPT_NAME"]) . "/");
        define("ADMIN_URL", DOMAIN . ADMIN_DIR );
    }

    if(!defined("ADMIN_PATH"))
    {
        throw new \Exception("Para acessar um módulo do backend você precisa esta no diretorio do admin/");
    }

    // configura a sessao do usuario
    $this->context->set("USER.SESSION", $this->context->get("USER.SESSION") . ADMIN_PATH . "_ADMIN");

    // configura o template do ADMIN
    // checa se o usuario especificou algum caminho para o template do ADMIN
    $templatePath = $this->context->get("CMS.ADMIN.TEMPLATE_PATH");
    if(!$templatePath){
        $templatePath = ADMIN_PATH;
    }
    $this->context->setTemplatePath($templatePath); //diretorio raiz de templates?
    $this->context->setTemplate($this->context->get('CMS.ADMIN.TEMPLATE')); // seta o template configurado no config.php

    // checa se o usuario especificou algum caminho para o template do ADMIN
    $templateUrl = $this->context->get("CMS.ADMIN.TEMPLATE_URL");
    if(!$templateUrl){
        $templateUrl = ADMIN_DIR; // URI do admin: http://localhost/admin/
    }
    if(!defined("TEMPLATE_URL"))
        define("TEMPLATE_URL", $templateUrl . $this->context->TemplateDir() . $this->context->getTemplate() . "/");
}

@Rafaelphp Files are being called through TEMPLATE_URL :

<link rel="stylesheet" href="<?php echo TEMPLATE_URL ?>static/css/bootstrap.min.css" rel="stylesheet">

I'm still trying to get him to call straight, but to no avail.

    
asked by anonymous 22.07.2016 / 21:51

1 answer

1

I think part of the problem is this:

define("SITE_PATH", __DIR__ . '/');
define("SITE_VIRTUAL_DIR", str_replace($_SERVER["DOCUMENT_ROOT"], "", SITE_PATH));

The name "SITE_VIRTUAL_DIR" suggests that it should be the virtual path, but it is mingling with the physical path.

To understand better, physical path is something like C:/www/site/ ;
And virtual path is something like http://site/foo/

In the codes you posted you can not tell where the error really is because the final result is mounted in that section

 if(!defined("TEMPLATE_URL"))
        define("TEMPLATE_URL", $templateUrl . $this->context->TemplateDir() . $this->context->getTemplate() . "/");
}

A practical way to find the problem is to create breakpoints in the most obvious places and analyze the data.

Tips for breakpoints:

Soon after define("SITE_VIRTUAL_DIR", str_replace($_SERVER["DOCUMENT_ROOT"], "", SITE_PATH)); , add echo SITE_VIRTUAL_DIR; exit;

If it's not wrong, go to another logical point and make another breakpoint.
Obviously, disable the previous breakpoint to continue execution.

Soon after this line

define("TEMPLATE_URL", $templateUrl . $this->context->TemplateDir() . $this->context->getTemplate() . "/");

Add this

echo TEMPLATE_URL.PHP_EOL.'<br>';
echo $templateUrl.PHP_EOL.'<br>';
echo $this->context->TemplateDir().PHP_EOL.'<br>';
echo $this->context->getTemplate().PHP_EOL.'<br>';
exit;

I'm pretty sure that's where you'll get a better idea of the source of the problem. For you will know where exactly the part that is mounting wrong comes from.

But I do not guarantee anything. They are just logical observations. Just try to understand the logic of breakpoints to debug your code and then learn how to fix your codes.

Another thing more obvious still is, find out if there is no documentation of this system or if you can not consult the author of it. A simple query might be better than licking code.





The World Travel Guide Related question (SO-en) link

    
01.08.2016 / 14:36