Search code examples
phphtmlbreadcrumbs

php breadcrumbs DO NOT display them on specific pages


I have a html project, with various template files. I want to display breadcrumbs, in all pages except on index.php and contact.php. I have the breadcrumbs working; what I can't get it to work is the condition for only displaying it if the pages are not index.php or contact.php:

So far, I know I could do this if it was in the other way around, only display it on those pages:

 $noBreadcrumbs = array("index.php", "contact.php");
    foreach ($noBreadcrumbs as $page => $pageName) {
      if (stripos(filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING), $pageName)){
      echo '<div class="breadcrumbs container">';
          require ("breadcrumbs.php");
          echo '</div>';
    }
  }

But because it has to be in the other way around.... I don't know how to do it! If I echo de request uri it appears also with the project name (thousand_motors/index.php), and.... I am stuck. I can't print only "index.php" and even if so, I don't know how can I do the foreach but when they are not those pages...

Any suggestions?

Thank you


Solution

  • have you tried

    if (!stripos( //....