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

  • Home
  • SEARCH
  • 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 6675813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:54:24+00:00 2026-05-26T03:54:24+00:00

I have a PHP menu which I include simply via <?php include_once(includes/blog.php) ?> I’m

  • 0

I have a PHP menu which I include simply via

<?php include_once("includes/blog.php") ?>

I’m trying to figure out how to reformat the link text in the menu if the linked page is being displayed in the browser – e.g. (simple example)

PHP inserts the following links:

One Two Three Four

If Four is clicked and the page loaded, I would like it to appear as

One Two Three Four

Is this possible (I have searched my apologies if I’ve missed something).

  • 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-05-26T03:54:24+00:00Added an answer on May 26, 2026 at 3:54 am

    You can do this several ways, $_GET vars, $_SESSION data, reading the current page url,

    Here is one way to do it….

    Make your links so that:

    //On your actual page
    <style>
    .bold{ font-weight:bold; }
    </style>
    
    //In includes/blog.php
    <?php
    echo '<a href="pageone.php?id=1" class="'.(($_GET['id'] == "1") ? 'bold' : '').'">One</a>';
    echo '<a href="pagetwo.php?id=2" class="'.(($_GET['id'] == "2") ? 'bold' : '').'">Two</a>';
    ?>
    

    You’ll need to format that to whatever you have, but hopefully you get the idea.

    This part class="'.(($_GET['id'] == "1") ? 'bold' : '').'" Means, If $_GET[‘id’] equals 1, then echo ‘bold’. So if our link that we clicked was pageone.php?id=1, we know we would have a $_GET variable named ‘id’ that was equal to 1. So our class would look like: class="bold". If our page has the .bold{ font-weight:bold; } on it, then our selected link will be bold.

    If you aren’t using any framework that keeps track of your pages, then you can use $_SERVER[‘PHP_SELF’] to do matching against your link.

    See the manual: http://www.php.net/manual/en/reserved.variables.server.php

    If someone typed in http://www.example.com/pageone.php

    $_SERVER[‘PHP_SELF’] would contain /pageone.php So you could do some more checking like

    if($_SERVER[‘PHP_SELF’] == ‘/pageone.php’){ echo ‘bold’; }

    This is quite an ugly way of doing it, though it may work for your purposes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which is PHP Frameset , with left frame(menu) and
I'm trying to work out the best way to assemble the navigation menu of
I have two .php files which show all contacts in a database, then allows
i have some index.php page.. after download jquery drop down menu,the link text like
I have table which contains the rows that are dynamic from server side scripting(PHP)
I have a navigation menu within a page on my site, which has JavaScript
I'm loading in content using an iframe via a menu with jquery which is
I have a web system which has a classical parent-children menu saved in a
I have a problem with include pages in PHP. Picture shows what I want
I have a personal web site at a PHP host and include a fixed

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.