Forum
siteURL in global.header.php
I need the site url set in perch settings in my global.header.php
To make something like: <link href="<?php echo $siteUrl; ?>/static/plugin/bootstrap/css/bootstrap.min.css" rel="stylesheet">
How can I do that?
I need the site url set in perch settings in my global.header.php
To make something like: <link href="<?php echo $siteUrl; ?>/static/plugin/bootstrap/css/bootstrap.min.css" rel="stylesheet">
How can I do that?
Hi, does
work for you?
Hi Simon,
Thanks for your answer. Your solutions doesn't work for me. I need a solution for my local dev en live site. Local is something like https://localhost/myproject. Your solution wil output "localhost". Was hoping to just use perch settings
Hi
I wouldn't recommend working with Perch in a subfolder. Create a virtualhost to map the folder you want to work in locally to a domain. That way your root stays the same wherever you run the website. Then you don't really need to worry about server paths so much.
There are plenty of ways you can achieve the above. You can use Simon's method, which is perfectly valid, you can use
$_SERVER['DOCUMENT_ROOT']
instead to get the full path, you could use relative paths (which is easier), and you could use a Perch Feather.They are all listed in the docs.
Hope this helps you get sorted.
Jon