Created
January 15, 2012 03:42
-
-
Save honzajavorek/1614194 to your computer and use it in GitHub Desktop.
minimální PHP controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// tohle zjisteni rootu je docela prasecina, kdysi davno jsem to vymyslel a fungovalo to (dneska uz to za me delaji frameworky) | |
define('WEB_ROOT', rtrim(str_replace('\\', '/', (dirname($_SERVER['PHP_SELF']) == '/')? '' : dirname($_SERVER['PHP_SELF'])), '/')); | |
?> | |
<ul> | |
<li><a href="<?php echo WEB_ROOT ?>/neco">root/</a></li> | |
<li><a href="<?php echo WEB_ROOT ?>/neco">root/neco</a></li> | |
<li><a href="<?php echo WEB_ROOT ?>/neco/dalsiho">root/neco/dalsiho</a></li> | |
</ul> | |
<p>Cesta od rootu webu k tomuhle skriptu je: <?php echo WEB_ROOT ?></p> | |
<p>Parsovat se bude: <?php echo $_SERVER['REQUEST_URI'] ?>, dobre bude asi zacit odriznutim toho rootu: <?php echo preg_replace('#^' . preg_quote(WEB_ROOT) . '#', '', $_SERVER['REQUEST_URI']) ?></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment