Jump to content
Jonathan Lahijani

$config->urls->templates with absolute URL?

Recommended Posts

Hi, I think you might want to combine it with: $config->httpHost

  • Like 4

Share this post


Link to post
Share on other sites

yep, was also the best solution i found:

<a href="//' . $config->httpHost . $booking->editUrl . '" target="_blank">

Share this post


Link to post
Share on other sites

In recent PW3 versions you can prepend "http" and get absolute urls like this:

$config->urls->httpTemplates

 

  • Like 10

Share this post


Link to post
Share on other sites
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??

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...