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 8468597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:58:46+00:00 2026-06-10T15:58:46+00:00

I have a menu that appears on all my pages. It contains php for

  • 0

I have a menu that appears on all my pages. It contains php for passing filenames to url’s as follows. Here is a snippet…

document.write('<li><a href="somefile.php?folder=<?php echo "_abc"; ?>">abc</a></li>');
document.write('<li><a href="somefile.php?folder=<?php echo "_def"; ?>">def</a></li>');
document.write('<li><a href="somefile.php?folder=<?php echo "_ghi"; ?>">ghi</a></li>');

It includes css and that works fine.
I have saved the menu as a seperate .js file and used…

<script src="js/menucss.js"></script>

…to load it from each page that I want it to appear. The menu displays and the css works fine – however the php does not parse and the page shows the php markup. What am I doing wrong?

Thanks in advance.
Neil

  • 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-10T15:58:47+00:00Added an answer on June 10, 2026 at 3:58 pm

    You shouldn’t do it like that.

    Have a page called menu.php saved somewhere, which includes:

    <ul>
    
        <li><a href="somefile.php?folder=<?php echo "_abc"; ?>">abc</a></li>
        <li><a href="somefile.php?folder=<?php echo "_def"; ?>">def</a></li>
        <li><a href="somefile.php?folder=<?php echo "_ghi"; ?>">ghi</a></li>
    
    </ul>
    

    Then include it, on the server side (index.php):

    <html>
    <head>
        <title></title>
    </head>
    <body>
    <header>
        <?php include("main.php"); ?>
    </header>
    </body>
    </html>
    

    This approach is far superior:

    • It does not require an extra request to get the data.
    • There will be no flickering or awkward moments of data loading, the menu would appear as if you’ve coded it directly into the page.
    • It’s much faster.
    • It doesn’t use JavaScript, which the client can choose to disable.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a menu that contains just one item. Button exit; @Override public boolean
I have, for example, 3 different pages. All pages should have a menu div,
I have a simple navigation menu with plain html links that target different pages.
I have a menu that uses SSIs, problem is the tag needs an id
I have a menu that changes and I want to show content in the
I have a menu that looks something like this: <MenuItem x:Name=menu ItemsSource={Binding Items} Style={StaticResource
I have a menu that will return 'e' unless the input is d or
I have a menu that if you click it it loads external content then
My ultimate goal is to have a menu that adds a class to the
So on my page I have a menu that is fixed to the top

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.