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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:25:46+00:00 2026-05-16T11:25:46+00:00

I want all my dynamic generated php links to be displayed like in example

  • 0

I want all my dynamic generated php links to be displayed like in example 1 below and when I click on a link which takes
me to another page all its sub links are displayed like in example 2 and when I click on one of those links all its sub
links are displayed like in the rest of the examples.

I’m using PHP, MySQL and Jquery for my web site if that helps.

Example 1

<ul>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
</ul>

Example 2

<ul>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a>
      <ul>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a>
      </ul>
    </li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
</ul>

Example 3

<ul>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a>
      <ul>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a>
          <ul>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a>
          </ul>
        </li>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a></li>
      </ul>
    </li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
</ul>

Example 4

<ul>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a>
      <ul>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a>
          <ul>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a>
              <ul>
                <li><a href="link.php">Fourth Nested List</a></li>
                <li><a href="link.php">Fourth Nested List</a></li>
                <li><a href="link.php">Fourth Nested List</a></li>
              </ul>
            </li>
            <li><a href="link.php">Third Nested List</a></li>
            <li><a href="link.php">Third Nested List</a></li>
          </ul>
        </li>
        <li><a href="link.php">Second Nested List</a></li>
        <li><a href="link.php">Second Nested List</a></li>
      </ul>
    </li>
   <li><a href="link.php">First Nested List</a></li>
   <li><a href="link.php">First Nested List</a></li>
</ul>
  • 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-16T11:25:46+00:00Added an answer on May 16, 2026 at 11:25 am

    I want all my dynamic generated php links to be displayed like in
    example 1 below and when I click on a
    link which takes me to another page
    all its sub links are displayed
    like
    in example 2 and when I click on one
    of those links all its sub links are
    displayed like in the rest of the
    examples.

    The bold part is not so clear.

    all my dynamic generated php links
    

    how is it dynamic generated? via ajax? please explain further.

    takes me to another page all its sub links are displayed
    

    If clicking a link takes you to another page, then displaying a sublink should be done on server-side. Yes you can do it client-side via jQuery but I think it would be not practical.

    Summary.

    Use your php to display your sublinks.

    HTML

    <ul>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a>
          <ul>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a>
              <ul class="active"> <!-- active UL -->
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a>
                  <ul>
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                  </ul>
                </li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
              </ul>
            </li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
          </ul>
        </li>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a></li>
    </ul>
    

    CSS

    ul.active ul {
        display: none;
    }
    

    with that above, use your php skills to add/remove class active to a ul. By doing that so, and with the definition of your CSS, any ul inside active ul is not visible. In above, Fourth Nested List will not be shown on page.


    update

    ul ul {
        display: none;
    }
    ul.active {
        display: block; /* or display:inline; */
    }
    

    example

    <ul>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a>
          <ul>  <!-- this will be hidden and all it's sub ul -->
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a>
              <ul>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a>
                  <ul>
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                  </ul>
                </li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
              </ul>
            </li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
          </ul>
          <ul class="active"> <!-- active UL, this will be displayed on the browser -->
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a>
              <ul class="active"> <!-- this will be shown if it's closest parent ul is active also -->
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a>
                  <ul>  <!-- this will be hidden and all it's sub ul -->
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                    <li><a href="link.php">Fourth Nested List</a></li>
                  </ul>
                </li>
                <li><a href="link.php">Third Nested List</a></li>
                <li><a href="link.php">Third Nested List</a></li>
              </ul>
            </li>
            <li><a href="link.php">Second Nested List</a></li>
            <li><a href="link.php">Second Nested List</a></li>
          </ul>
        </li>
       <li><a href="link.php">First Nested List</a></li>
       <li><a href="link.php">First Nested List</a></li>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 514k
  • Answers 514k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I get the same results as you do on my… May 16, 2026 at 6:20 pm
  • Editorial Team
    Editorial Team added an answer This is the expected behavior, your script should response to… May 16, 2026 at 6:20 pm
  • Editorial Team
    Editorial Team added an answer I would say that step one is to split their… May 16, 2026 at 6:20 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

my dynamic generated html look like below <ul class=missingList> <li>Please select at least one
Something, I think Apache, adds these HTTP headers to all responses generated by PHP
I have got a problem. I have windows forms application with dynamic generated layout,
Im creating a web app where I want all of the responses to the
just exploring c# 4. Trying to get my head around all this dynamic stuff.
I have searched online for a while and almost all the questions regarding image
I have a form that is dynamically generated, and has dynamically generated id's (and
I've been looking into ASP.NET Dynamic Data and how it does scaffolding and routing.
Suppose (for the sake of argument) that I have a view class which contains
i have rectangles and images and i want to show that images on that

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.