Ashish Detroja
Ashish Detroja

Reputation: 1082

How do i get base url in OctoberCMS?

I want to show image in backend render list. For that how to get the path to show image. We have tried base_path() method.

But it gives me full path like "opt/lampp/htdocs/ashish/" but i want to get http://localhost/ashish

Upvotes: 12

Views: 16668

Answers (4)

inalto
inalto

Reputation: 171

You can use:

Config::get('app.url')

but first you have to properly configure your base path in app/config.php

I think is more general and you can also force the https if you need it.

Upvotes: 6

Tharanga
Tharanga

Reputation: 57

This the way that I have tried & proved its working nicely when working with displaying images from media manager.

Config::get('cms.storage.media.path')

Upvotes: 0

Will
Will

Reputation: 841

In twig you can do:

{{ url('/') }}

Upvotes: 20

Ashish Detroja
Ashish Detroja

Reputation: 1082

Please use Request::getBaseUrl() for get base path like http://localhost/ashish

Upvotes: 7

Related Questions