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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:58:15+00:00 2026-05-22T19:58:15+00:00

I am basically trying to hide a DIV on the homepage but have it

  • 0

I am basically trying to hide a DIV on the homepage but have it show elsewhere (Controled by the URL).

DIV name “left_col”

Trying to do this using just php.
How would this be done?

  • 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-22T19:58:16+00:00Added an answer on May 22, 2026 at 7:58 pm

    Supposing your homepage url was index.php, something like this should work and be very easy:

    // We're NOT on the home page
    if (strpos($_SERVER['REQUEST_URI'], "index.php") >= 0) {
      echo "<div id='left_col'>contents</div>";
    }
    

    There are many other ways to do this, depending on the rest of your architecture, if you use templating engines, or many other factors. If you post more context for your question and your environment, I could be more specific.

    EDIT To do this with CSS instead of fully suppressing output, this method specifies a class for each showing and hiding and applies it to the div.

    // We're NOT on the home page
    if (strpos($_SERVER['REQUEST_URI'], "index.php") >= 0) {
      $left_col_class = "showme";
    }
    else {
      $left_col_class = "hideme";
    }
    
    // Your html...
    <div id='left_col' class='<?php echo $left_col_class; ?>'>contents</div>
    
    // Your CSS
    .hideme { display: none; }
    .showme { display: block; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I am trying to show hide divs and links, but having some trouble.
I'm trying my best to make this make sense, but basically I have a
i am trying this code: <script type=text/javascript> $(document).ready(function () { $('#individual,#company').hide(); $('input[name=radios]:radio:checked').change(function() { $('#individual').toggle(this.selectedIndex
Say I have this: <div id=tabs class=hide> <ul> <li><a href=/tabs/1>Tab 1</a></li> </ul> </div> Tab
This should have been pretty straightforward using the DOM but I seem to be
I have a button that i basically want to either show or hide it
I'm trying to read a cookie, but don't have a clue how, basically. The
basically what i am trying to do i have 2 div which are hidden
I'm basically trying to do a dropdown jquery plugin. HTML <script type='text/javascript' src='script.js'></script> <div
I'm basically trying to create a 2 column div with a liquid <h1> and

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.