Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7814353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:10:11+00:00 2026-06-02T05:10:11+00:00

I am sure this is a fairly simple question to answer, but I am

  • 0

I am sure this is a fairly simple question to answer, but I am new to PHP, so I was hoping someone could help me solve this problem.

I have a dynamic navigation menu that works really well, but I want to remove the link from the current page in the menu.

Here is my code:

  <div id="navigation_menu">
  <?
  foreach($pagedata->menu as $menuitem){
      $class = ($menuitem->uri == $requesteduri) ? 'navigation selection' : 'navigation page_select';

      ?>
      <div id="<?=$menuitem->uri?>" class="<?=$class?>">
        <img class="nav_icon" src="<?=PROTOCOL?>//<?=DOMAIN?>/img/<?=$menuitem->uri?>.png">
        <h1><a href="<?=PROTOCOL?>//<?=DOMAIN?>/<?=$menuitem->uri?>"><?=$menuitem->title?></a></h1>
        <h2><?=$menuitem->description?></h2>
        <img class="go" src="<?=PROTOCOL?>//<?=DOMAIN?>/img/go.png">
      </div>
      <?      
  }
  ?>
  </div>

Any help would be greatly appreciated. Thanks!

UPDATED CODE: (this is what works for me now)

<div id="navigation_menu">
    <?
  foreach($pagedata->menu as $menuitem){
      $class = ($menuitem->uri == $requesteduri) ? 'navigation selection' : 'navigation page_select';
      ?>
      <div id="<?=$menuitem->uri?>" class="<?=$class?>">
        <img class="nav_icon" src="<?=PROTOCOL?>//<?=DOMAIN?>/img/<?=$menuitem->uri?>.png">
        <h1>
                <?php if ($menuitem->uri == $requesteduri):?>
            <?=$menuitem->title;?>
                <?php else: ?>
            <a href="<?=PROTOCOL?>//<?=DOMAIN?>/<?=$menuitem->uri?>"><?=$menuitem->title?></a>
                <?php endif;?>
                </h1>
        <h2><?=$menuitem->description?></h2>
        <img class="go" src="<?=PROTOCOL?>//<?=DOMAIN?>/img/go.png">
      </div>

      <?      
  }

  ?>
  </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:10:13+00:00Added an answer on June 2, 2026 at 5:10 am

    I don’t know what your loop is outputting, but you want to match your page name with the menuitem->uri. So you’d get your page name like.. (Put this outside the loop)

    <?php echo base_name($_SERVER['REQUEST_URI']); ?>
    

    find out what your loop is outputting (Put this in the loop):

    <?php echo $menuitem->uri; ?>
    

    Then you’d create an if statement to compare the current menuitem in the loop and the page request, this is just an example:

    <h1>
    <?php if (base_name($_SERVER['REQUEST_URI']) == $menuitem->uri):?>
       <a href="<?=PROTOCOL?>//<?=DOMAIN?>/<?=$menuitem->uri?>"><?=$menuitem->title?></a>
    <?php else: ?>
       <?=$menuitem->title;?>
    <?php endif;?>
    </h1>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure this question is fairly simple to answer... is there any way to
I am sure this is a fairly simple question but I can't seem to
I'm sure there is a fairly simple answer to this question, so here we
I'm sure this is a fairly trivial problem, but I'm not sure what to
I am fairly new to PHP and Codeigniter so im sure this will be
I'm fairly sure this is a template question, since I can't seem to solve
I'm sure this is fairly simple, however I have a major mental block on
I'm fairly sure there should be an elegant solution to this (in MATLAB), but
Pretty sure this question counts as blasphemy to most web 2.0 proponents, but I
Im sure this will be a simple one but have a project that started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.