Asked  2 Years ago    Answers:  5   Viewed   63 times

I have a div in php(string) and I want to get the content.

for example:

<div id="product_list" style="width:100%; float:none;">
      <div>
       bla bla bla
      </div>
      bla bla          
</div>

and I want

<div>
     bla bla bla
</div>
     bla bla

The style is changing, I know only the div id.

UPDATED

this is my code, same as turbod source and the results are the same too.

so this is the original html

$doc = new DOMDocument();
$doc->loadHTML($buffer);
$id = $doc->getElementById('product_list')

And after this code I get the following: link

 Answers

5

Use the php DomDocument class. http://www.php.net/manual/en/class.domdocument.php

$dom = new DOMDocument();

$dom->loadHTML($html);

$xpath = new DOMXPath($dom);
$divContent = $xpath->query('//div[id="product_list"]');
Sunday, October 16, 2022
1

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario: http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm

Related usability ticket: http://youtrack.jetbrains.com/issue/WI-18388

P.S. The WI-18388 ticket is already fixed in v8.0

Sunday, July 31, 2022
 
4

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Sunday, November 6, 2022
3

Apple has removed the ability to use this api in 7.0.3. What a shame.

You certainly can in iOS7, at least as of a few days ago. In our app once you set the following it makes your background transparent and shows the user wallpaper. If you try to programmatically take a screenshot, it will just show black instead.

  1. Set UIApplicationIsOpaque to false in the project plist

  2. In the app delegate load function:

    self.window.backgroundColor = [UIColor clearColor];

    self.window.opaque = NO;

  3. Set the UIViewController.view's background color to [UIColor clearColor]

Thursday, September 29, 2022
 
18

The set of currently supported python versions can be found in /usr/share/python/debian_defaults. Check whenever python-2.7 is listed there as supported.

There is a so-called python-support system in Debian. When python-support-aware package (i.e., when maintainer used python-support stuff while packaging) says that it supports specific range of Python versions, dpkg calls hooks for updates to installed runtimes as a part of postinst process. There's also alternative python-central system, which does the same thing.

Tuesday, December 13, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages