How to hide an entire ID-based DIV with PHP?

Asked

Viewed 394 times

0

How can I hide a div entire using PHP?

Assuming the HTML file:

<div id="e_4046058" class="event active">
  <div class="columns">
    <div class="eventInfo">
    <span class="StartTime">16/03/2015 16:00 WET</span>
   <input class="decValue" type="hidden" value="0.00"></div>
    <div id="b_84723885" class="selections active">
</div>
      </div>
           </div>
                   </div>

This DIV is coming from an external website, so I use the file_get_contents to obtain these contents.

I was wondering if you could cover up div id="e_4046058" with all its contents.

Supposing I had two div of these:

<div id="div1" class="event active">
  <div class="columns">
    <div class="eventInfo">
    <span class="StartTime">16/03/2015 16:00 WET</span>
   <input class="decValue" type="hidden" value="0.00"></div>
    <div id="b_84723885" class="selections active">
</div>
      </div>
           </div>
                   </div>

 <div id="div2" class="event active">
          <div class="columns">
            <div class="eventInfo">
            <span class="StartTime">16/03/2015 16:00 WET</span>
           <input class="decValue" type="hidden" value="0.00"></div>
            <div id="b_84723885" class="selections active">
        </div>
              </div>
                   </div>
                           </div>

You can hide all the div id="div1"? What should I use to do this? DOMDocument work out? I don’t know any method I can use to hide a div based on the ID of the same. If you have any possibility I ask your help to try to create this module. Thanks in advance!

  • can use Domdocument or only string manipulation functions like substr, str_replace, etc..

  • I tried something, but he hid only the div itself, and not everything in it, he just erased the <div id="div2" class="event active">, but the rest of the code was!

  • if you want to use domdocuemnt, with 4 words in google vc you will find thousands of solutions in a fraction of seconds, example: "php dom remove div".

  • You can put on your own div a style diplay:none, nay?

  • There is also Phpquery: https://code.google.com/p/phpquery/ PHP solution with similar usability to Jquery.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.