title: Relative path to external dependencies in Slim PHP using $app->render()
body: <p>If I render an actual html site with external dependencies (javascript/css) using </p>
  
  <pre><code>$app-&gt;render("./somewhere/index.html");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>echo "&lt;html&gt;...&lt;/html&gt;";
  </code></pre>
  
  <p>for some reason slim cant resolve the dependency paths - so the site can't be loaded correctly. An workaround is $app->redirect("./somewhere/index.html"); instead of $app->render("./somewhere/index.html"); - but then also the URL path in browsers adress bar changes. I want to avoid that, because I just want to display an HTML template for the REST request I'm receiving from the URI - so theres no point to redirect to an html document and lose the REST Parameters.</p>
  
  <p>An sscce for my problem:</p>
  
  <p>dir structure:</p>
  
  <pre><code>- index.php
  + templates
  |-- index.html
  |-- dependency.js
  + Slim
  |-- ...
  |-- ...
  </code></pre>
  
  <p>index.php:</p>
  
  <pre><code>&lt;?php
  require 'Slim/Slim.php';
  \Slim\Slim::registerAutoloader();
  $app = new Slim\Slim();
  $app-&gt;get('/:id', function ($id) use ($app) {
      $app-&gt;render('index.html');
  });
  $app-&gt;run();
  ?&gt;
  </code></pre>
  
  <p>/templates/index.html:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;SSCCE&lt;/title&gt;
      &lt;script id="someid" type="text/javascript" src="dependency.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="javascript:func_test()"&gt;Click here&lt;/a&gt; 
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>/templates/dependency.js:</p>
  
  <pre><code>function func_test() {
    alert("Test");
  } 
  </code></pre>
  
  <p>1.) Success: 
  Access the /templates/index.html directly. (i.e. by entering 127.0.0.1/templates/index.html). Clicking on 'Click here' opens a message box.</p>
  
  <p>2.) Failure: 
  Access the index.php File from Slim (note: I haven't activated mod_rewrite on the webserver - so I'm using index.php/.../ as URI i.e. 127.0.0.1/index.php/testid). The html site loads correctly, but if I click on 'Click here' nothing happens.</p>
  
  <p>I already tried: different variants of src="../dependency.js", src="../templates/dependency.js", changing index.html into an php file and using src="$webroot/templates/dependency.js" - but nothing worked. Any idea how to fix this? </p>