php


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.

Related Links

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'))

Categories

HOME
class
eclipse-plugin
antd
subdomain
gallery
mosquitto
ontology
implicit-conversion
drag-and-drop
openfoam
gprs
save
jpa-criteria
yahoo
pm2
spring-jpa
bundler
jodatime
sql-injection
maven-plugin
azure-machine-learning
unity-container
web-analytics
kaggle
batch-rename
eclipse-emf
router
ipa
uilocalnotification
bobo-browse.net
tsung
substance
google-play-developer-api
premake
windows2012
argv
wdk
ng-repeat
mars-simulator
llvm-ir
linq.js
rdp
windows-store
klee
flipkart
opal-framework
return-type
brightscript
comm
gtk#
htmlspecialchars
dtd
kendo-editor
openerp-6
d3v4
e
livecycle
msbuild-4.0
bbc-micro
node-glob
jeasyui
utf-16
self
ruby-on-rails-4.1
nette
relational-model
dbmigrate
webproject
findersync
baseadapter
createfile
adhoc-polymorphism
symja
datagridcomboboxcolumn
iplimage
squeezebox
mod-perl
sensormanager
facebook-game-groups
visual-c++-2005
progress-db
discovery
apache-shindig
google-code-prettify
pacman
insertion
html-frames
office-app
red-system
spark-view-engine
exponent
django-apps
server-variables
cewolf
simile
turbine
cassini
reliability
facebook-fbml
mysqli-multi-query
jquery-effects
.net-client-profile
motif

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App