dimanche 30 octobre 2016

Define parent URL-Path of an Web-Application

This is mightbe a basic question, but I wasn´t able to find an answere anywhere on google (maybe I was to stupide to know what to Google for). Thanks in addvanced for even trying to understand my problem.

Scenario:

Dir: C:/xampp/htdocs/MY_PROGRAMM
URL: localhost/MY_PROGRAMM

Style File:

Dir: C:/xampp/htdocs/MY_PROGRAMM/inc/style.css
URL: localhost/MY_PROGRAMM/inc/style.css

Page:

Dir: C:/xampp/htdocs/MY_PROGRAMM/categorie/(or more folders)/page.php
URL: localhost/MY_PROGRAMM/(or more folders)/page.php

And I want any page to be able to set the style on any page, I would have to know that the Programm Url is "localhost/MY_PROGRAMM/"

So I know how to get the "server" dir of my programm

define('SERVER_ROOT', dirname(__FILE__)); or getcwd()

SERVER_ROOT = /mnt/web/a/server/htdocs/maybefolder/ormore/"MY_PROGRAMM"

But this woulnd´t be useable in html code like

so my idea was to get the root dir as normal url like this

CLIENT_ROOT = http://ift.tt/2eRsd8P"MY_PROGRAMM"

<link rel="stylesheet" type="text/css" href="CLIENT_ROOT/style.php">

But how could I achive this, even when I switch to an online server? Is there an universal solution?




Aucun commentaire:

Enregistrer un commentaire