PHP Template Function: full_url
Posted by Mark [Elevated X Support], Last modified by kayako kayako on 02 November 2018 10:49 AM

Description:

This will convert the path to a file to a full qualified URL. If the path passed along is already a full qualified URL, this function will return its output.

Common Location:

/cms_admin/phptemplate/<templatefolder>/functions/standard.tpl

Usage:

<?= full_url("/path/to/file.html"); ?>

<?= full_url("http://yourdomain.com/path/to/file.html"); ?>

Arguments

1) The path to the file / location.

Output

If this code is being run on yourdomain.com, the output of this function will be:

http://yourdomain.com/path/to/file.html

http://yourdomain.com/path/to/file.html

If this code is being run on yourdomain2.com, the output listed above will be:

http://yourdomain2.com/path/to/file.html

http://yourdomain.com/path/to/file.html

This is because if there no absolute URL specified, full_url() will substitute the existing HTTP_HOST name in its place.

 

(0 vote(s))
Helpful
Not helpful

Comments (0)