php - Web project development in subfolder -


for example working on 2 projects, & b, both of them in future hosted in root directories. atm have 1 apache web server default parameters , want start working, create folder , folder b, store needed files.

the problem when ll use

<script type="text/javascript"  src="/resources/scripts/javascript.js" ></script> <link  href="/resources/styles/stylesheet.css" rel="stylesheet" type="text/css" /> 

both of projects call files apache root folder (httpdocs), not /a/ , /b/ folders.

things worse when using php framework, cant use

<link  href="./resources/styles/stylesheet.css" rel="stylesheet" type="text/css" /> 

(dot before /resources/) because routing project trying access controller folder , resources there.

sounds small problem, cant figure out , close question myself, each time need develop invent workarounds again , again :)

a way of handling use constant holds path project. way have edit constant paths right.

define('basedir', '/a/'); echo ' <script type="text/javascript"  src="'.basedir.'resources/scripts/javascript.js" ></script> <link href="'.basedir.'resources/styles/stylesheet.css" rel="stylesheet" type="text/css" />'; 

this turn paths into

<script type="text/javascript"  src="./a/resources/scripts/javascript.js" ></script> <link href="./a/resources/styles/stylesheet.css" rel="stylesheet" type="text/css" />'; 

if keep constant in seperate file can include you'd need it. php file handles ajax request instance.


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -