I want to create a condition for any pages that will be here: / user / The pages themselves can have any name.
I have an example like this:
if(($_SERVER['REQUEST_URI']) =='/user/index.html') { echo 'class="userlog"'; }
But it only works on a specific page (in this case index.html)
How to be?
Try this:
if(($_SERVER['REQUEST_URI']) == '/user/' . basename(__FILE__)) { echo 'class="' . basename(__FILE__, '.php') . '"'; }
Check the result of global variable $_SERVER['REQUEST_URI']
and use .php
in the files extensions.