0
I don’t know much about PHP.
I have a part of the site that contains a <a>
with the current path from where the customer is.
That is the code:
<a href="
<?php if(preg_match("/segmentos/i", $_SERVER['REQUEST_URI']))echo '/segmentos/neomot-'.$url[0]; ?>
<?php if(preg_match('/elevadores\/atuacao/i',$_SERVER['REQUEST_URI'])) echo '/atuacao'; else echo '/produtos';?>">
<?php if(preg_match('/elevadores\/atuacao/i',$_SERVER['REQUEST_URI'])) echo 'Atuação'; else echo 'Produtos';?>
</a>
What happens, it will check if the link is on /elevadores/iluminacao
he’s gonna give a echo
with the correct url, if not this and is iluminacao/produtos
he will echo to produtos
for example, what if I want to put one more condition?
Type include cases also, in the same way that is in products.
No longer has an example of
else
right there on the last line?– André Ribeiro
Just include
; else echo 'Cases'
?– Felipe Viero Goulart
Your question is a little confused. In which case you want to print
cases
?– André Ribeiro
if the link is
/cases
, the same is the call in/produtos
.– Felipe Viero Goulart