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.
$nodeList = GenericParser::getContentFromXPath( file_get_contents(__DIR__ . '/templates/domdocument_mz.html'), [ '//*[@class="inner_article"]/a', '//*[@class="articles_wrapper"]/a', ], [ 'subtitle' => '/*[contains(@class, "subtitle")]', 'lead' => '/*[contains(@class, "lead")]', ], ['href', 'value'], ['subtitle' => 'mainNode', 'lead' => 'subNode'], );
The nodeList, when successful, will contain two variables:
|nodeInfo||Raw node info.|
|rendered||The rendered array.|