i also then have a carbon copy sandbox test version of the site.
i am using google analytics.
is there anyway of getting the current url so i can see if /sanbox/ is in the url, so i can leave out the analytics code that goes at the bottom of the page?
this would allow me to copy and paste files rather than having to make the changes to both live and test code(to avoid test site vewings amending my google stats)
any ideas how i can get the url i am currently on?
PHPWeb Development
Last Comment
scm0sml
8/22/2022 - Mon
richswyatt
Sure:
$currentURL = $_SERVER['PHP_SELF'];
and then use preg_match() or strstr() to look for /sandbox/
using the above i get:
sandbox/index.php which will allow me to do the above but is there a way of getting the whole url, i.e www.someaddress..........index.php
as this would also allow me to tell if i was running locally or uploaded to allow local code to not affect stats too?
$currentURL = $_SERVER['PHP_SELF'];
and then use preg_match() or strstr() to look for /sandbox/
Hope that helps?