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

Fix web-root & code portability #4

Open
nfreear opened this issue Mar 1, 2016 · 0 comments
Open

Fix web-root & code portability #4

nfreear opened this issue Mar 1, 2016 · 0 comments
Assignees

Comments

@nfreear
Copy link
Contributor

nfreear commented Mar 1, 2016

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">

...
nfreear added a commit that referenced this issue Mar 1, 2016
@nfreear nfreear self-assigned this Mar 1, 2016
nfreear added a commit that referenced this issue Mar 4, 2016
* plus Bug #5, Accessibility fix - default page title [iet:5232140]
* Bug #4, web-root in some `views` + `default` template [iet:5231955]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant