Putting URL in variable then Echo
Posted: Sat Dec 31, 2011 6:50 pm
I'm having trouble using PHP to display the current URL in the Address bar. I see I need to use $_SERVER['REQUEST_URI'] but I need it in a variable then echo it later on a page.
I tried reading some tutorials but I'm not seeing a solution for doing this with PHP.
Code: Select all
<?php
if(!$id || count($headerinfo) < 1) { echo '<a href="'.$site_url.'">'.$site_name.'</a> / '.$pname.'';
$comments_layout = '1';
$comMents = "";
} else {
$comments_layout = '2';
$comMents = "<div class="alignleft"> PHP to show Page URL </div>";
?>
HTML Code
<?php echo '$comMents'; ?>