CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Automatically building a default install URL...  (Read 224 times)

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 792
  • Karma: +8/-0
    • Grumpy Young Man
Automatically building a default install URL...
« on: 28 Nov 2022, 09:00:32 am »
Hello is there a way of automatically creating a self install URL without having to hard code it, this to me would be handy for when you are using mod_rewrite for example, or you have a private development area and a public testing area, or two different test area locations?

So lets the private area is example.com/privateTestArea/myTestScript and the public one is example.com/publicArea?

I am have not posted code as I am trying to work out to do it, I may post back code once I worked it out...

Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

GrumpyYoungMan

  • Hero Member
  • *****
  • Posts: 792
  • Karma: +8/-0
    • Grumpy Young Man
Re: Automatically building a default install URL...
« Reply #1 on: 29 Nov 2022, 03:04:30 am »
PHP
Code: [Select]
// Basic Setup
define('BASE_URL', (!empty($_SERVER['HTTPS']) ? "https" : 'http') . '://' . $_SERVER['HTTP_HOST']);
define("URL_PATH", pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME));

then it can be used lilke this:

HTML
Code: [Select]
<link rel="stylesheet" href="<?php echo URL_PATH?>/gym-global-screen.css">
« Last Edit: 29 Nov 2022, 03:15:23 am by GrumpyYoungMan »
Trying to learn a new trick to prove old dogs can learn new ones...

Total Novice have-a go Amateur Programmer - not sure that is the right thing to say... but trying to learn...

 

SMF spam blocked by CleanTalk

Advertisement