I have a file with dynamic content in PHP. I have a div that I want to be displayed whenever the site link is / who-is.
How to do this in PHP?
I have a file with dynamic content in PHP. I have a div that I want to be displayed whenever the site link is / who-is.
How to do this in PHP?
You can use preg_match
to check if the URL ends with the string /quem-somos
or /quem-somos/
:
<?php
$url_atual = $_SERVER[REQUEST_URI]; // URL da página atual
$match = preg_match('\/quem-somos[\/]?$/', $url_atual, $matches); // verifica a string na URL
if($matches){ // se casou, carrega a div
?>
<div></div>
<?php
} // fecha o if
?>
So I understand and only you use the GET mode.
$url=$_GET['mostrar'];
if($url="quem-somos"){
echo "<div id='IDdaDiv'> </div>";
}
So if the url is site.com/index.php?show=we are it will show the div case if n n goes. you can use friendly URL for n to show "index.php? show=" and yes only "site.com/we--"