Answer the question
In order to leave comments, you need to log in
How to check if a user is on a specific url using php?
Friends, hello.
I have a task to call a popup when I am on a certain page. I went through the documentation, but did not understand how to organize a check for a yurl? And whether I write something wrong, but I did not find the answer to the question in Google. It's like everyone knows it but me.
I decided to call the popup like this:
if (проверка нахождения юзера на определённом юрл) {
require ("show-modal.php");
}
Answer the question
In order to leave comments, you need to log in
Generally - depends on CMS.
But there are general options.
For example, look into the $_SERVER super-global array
AND look at something like
echo '<pre>'; print_r($_SERVER); echo '</pre>';
$_SERVER['REQUEST_URI']
It's like everyone knows it but me.
CSite::InDir();
$APPLICATION->GetCurDir();
$APPLICATION->GetCurPage();
Dudes, isn't it easier to check the URL through javascript on the client and do this window already there?<script>
if(document.URL.indexOf("/catalog/furshetnye_zakuski/")!=-1)
{
alert("popup!");
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question