Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.
This repository was archived by the owner on May 4, 2023. It is now read-only.

Fix web-root & code portability #4

Description

@nfreear

site/config/config.DIST.php:

<?php
...

         'db' => array(
              'connectionString' => 'mysql:dbname={ EDIT ME };host={ EDIT ME };charset=utf8',
+            // With PORT: 'connectionString' => 'mysql:dbname={ EDIT ME };host={ EDIT ME };port={ EDIT ME };charset=utf8',

-        )
+        ),
+        'webroot' => '',  //{ EDIT ME }

framework/base/CWebApplication.php:

<?php
...

         public function __construct() {
              $this->config = require('site' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php');

-            $this->documentRoot = $_SERVER['DOCUMENT_ROOT'];
+            $this->documentRoot = __DIR__ . '/../..';   //Was: $_SERVER['DOCUMENT_ROOT'];

+            $this->webRoot = $this->config['webroot'];

site/templates/default.php:

<?php
...

-    <link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
-    <link href="/css/styles.css" rel="stylesheet" media="screen">
+    <link href="<?php echo $webroot ?>/css/bootstrap.min.css" rel="stylesheet" media="screen">
+    <link href="<?php echo $webroot ?>/css/styles.css" rel="stylesheet" media="screen">

...

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions