Define BASE tag in html using php
I want to define the BASE tag in html using PHP <!DOCTYPE html> <html lang="<?php echo LANG; ?>"> <head> <meta charset="<?php echo CHARSET; ?>"> <base href="<?php echo BASE; ?>"> </head> .... Did some research here, and came up with this. config.inc.php define('LANG', 'es_ES'); define('CHARSET', 'utf-8'); define('SERVER_SERVER_NAME', 'http://' . $_SERVER['SERVER_NAME']); define('SERVER_PHP_SELF', dirname($_SERVER['PHP_SELF'])); define('BASE', SERVER_SERVER_NAME . SERVER_PHP_SELF . '/'); 2 questions: Is there a way to define the keyword http? Sometimes it can be https and hardcoding that keyword is a bad idea. Should i define the BASE value by ending it with a slash or not ? Any improvements on this very simple code? Thanks
Just leave the protocol out, and start the URL with //. It will then default to the protocol of the document that contains it. The <base> URL should end with a / if you want it to specify a folder.
how to list files in a directory without redirecting to index.php file?
sql join repeating results
How to compare the value contained in a variable and string without case-sensitivity in Smarty 2?
Connect to socket
Add Class in Anchor for CodeIgniter
Query DB with a class
Decoding JSON array
Update multiple rows in php and mysql by checkbox
Need an explanation of this particular form action
Script works on local, but not on live
Unique username test [duplicate]
How to correctly check if page was included? [duplicate]
PDO query result includes “PDO Object()”
How to prevent search engines from indexing wordpress menus
CSS png sprite tester
How to convert from IPv6 to it's original IPv4 format? (inet_ntop(inet_pton('ip address'))