Get Site URL?

Permalink 3 users found helpful
Anyone know code to get the site url? not base, directory.

 
jhl replied on at Permalink Reply
i guess not. then does anyone know how to get the site url not neccesarily the directory, or how to access site.php with some code?
jordanlev replied on at Permalink Reply
jordanlev
<?php echo View::url('/'); ?>
<?php echo View::url('/some-page'); ?>

First one is for home page of site, second one is for the "some-page" page. Couldn't understand your question exactly, but if you are looking for just the base url, you can also use this:
<?php echo SITE_URL; ?>
12345j replied on at Permalink Reply
12345j
I was looking for this too!
jordanlev replied on at Permalink Best Answer Reply
jordanlev
I think View::url() calls work in blocks as well.
jhl replied on at Permalink Reply
just what I was looking for!
Mnkras replied on at Permalink Reply
Mnkras
yep, you may also see it as $this->url('blah');
joemc replied on at Permalink Reply
joemc
I have pretty URLs setup, but when I use
$this->url('/somepage');

The 'index.php' shows up in the address bar.

Is there anyway to get rid of this?
Mnkras replied on at Permalink Reply
Mnkras
thats a known issue, you can stick
define("URL_REWRITING_ALL", true);

in the site.php
joemc replied on at Permalink Reply
joemc
Ah, cool. Thanks for the quick reply! That did the trick.
davidofadelaide replied on at Permalink Reply
davidofadelaide
Perfect!
TMDesigns replied on at Permalink Reply
TMDesigns
In v8 its

<?php echo  \Concrete\Core\Support\Facade\Url::to('/'); ?>