Php: funzioni basefolder

 Alcune funzioni basilari in php per impostare velocemente un basefoldere






<?php
define('BASEFOLDER', "HTML/"); // Subfolder
    function base_url () {
    return "http://".$_SERVER["HTTP_HOST"]."/".BASEFOLDER;
}
function get_current($name) {
  if (strpos($_SERVER['REQUEST_URI'], $name) !== false)
    echo "class=\"current_page_item\"";
}


$url = "http://".$_SERVER['SERVER_NAME'];
$sito = $_SERVER['SERVER_NAME'];
$pagina = "http://" . $_SERVER['SERVER_NAME']. $_SERVER['REQUEST_URI'];
$pagina_no_http = $_SERVER['SERVER_NAME']. $_SERVER['REQUEST_URI'];
$media= "http://" . $_SERVER['SERVER_NAME'].'/images/logo.jpg';
?>

Commenti