Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The above example renders this array. From here on and forward, it will be much easier to handle. The main reason for why we do like this in the current example is to avoid duplicate hrefs.

What if the above work is horrible?

It can be handled in one call also, as long as it is as "standard" as possible. Changes and adaptions may follow.

This is a oneshot and executes all above actions in one call.

Code Block
$nodeList = GenericParser::getContentFromXPath(
            file_get_contents(__DIR__ . '/templates/domdocument_mz.html'),
                'subtitle' => '/*[contains(@class, "subtitle")]',
                'lead' => '/*[contains(@class, "lead")]',
            ['href', 'value'],
            ['subtitle' => 'mainNode', 'lead' => 'subNode'],

The nodeList, when successful, will contain two variables:

nodeInfoRaw node info.
renderedThe rendered array.

Image Added