Jonathan Lahijani Posted May 28, 2016 Posted May 28, 2016 $config->urls->templates will give you the relative URL, not the absolute URL containing "http://mysite.com/" part. Is there are slick way to get the absolute URL? If not, what's the next best approach?
Sebii Posted May 28, 2016 Posted May 28, 2016 Hi, I think you might want to combine it with: $config->httpHost 4
bernhard Posted May 28, 2016 Posted May 28, 2016 yep, was also the best solution i found: <a href="//' . $config->httpHost . $booking->editUrl . '" target="_blank">
tpr Posted December 20, 2016 Posted December 20, 2016 In recent PW3 versions you can prepend "http" and get absolute urls like this: $config->urls->httpTemplates 10
Pixrael Posted May 30, 2017 Posted May 30, 2017 On 12/20/2016 at 2:35 AM, tpr said: In recent PW3 versions you can prepend "http" and get absolute urls like this: $config->urls->httpTemplates Works!.. Where you learn this??
Jonathan Lahijani Posted November 20, 2019 Author Posted November 20, 2019 On 5/30/2017 at 12:23 PM, tpr said: From the weekly blog The weekly blog had it here:https://processwire.com/blog/posts/processwire-2.6.18-updates-pagination-and-seo/#new-http-prefix-available-for-all-config-gt-urls-properties In the API:https://processwire.com/api/ref/paths/ Easy to miss this one.
bernhard Posted November 20, 2019 Posted November 20, 2019 Am I the only one often needing a httpsUrl instead of a httpurl? https://github.com/processwire/processwire/pull/116/commits/25be5b54edc16edc80b337723145142660f795c6 Maybe it would make sense to have not only $config->url() and $config->path() but also $config->httpUrl() and $config->httpsUrl() $config->url("/var/www/foo/bar/site/templates/style.css"); // /site/templates/style.css $config->path("/site/templates/style.css"); // /var/www/foo/bar/site/templates/style.css $config->httpUrl("/site/templates/style.css"); // http://www.foo.bar/site/templates/style.css $config->httpsUrl("/site/templates/style.css"); // https://www.foo.bar/site/templates/style.css $config->httpsUrl($pages->get(2)); // https://www.foo.bar/processwire/ What do you think? You can support my request here: https://github.com/processwire/processwire-requests/issues/326 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now