Hello,
I was wondering if there is a way to layer my preg_matches?
I have a code like this
preg_match("/\<div class=\"dealsListS\"\>(.*?)\<\/div\>(.*)\<\/form\>.*?\<\/div\>/is", $res[1], $bycontainer );
preg_match_all("/\<h2>\s*(\<div.*?\<\/div>\s*)?(.*?)\<\/h2\>/is", $bycontainer[0], $level1 );
preg_match_all("/\<div class=\"thumbWrapper\"\>(.*?)\<\/div\>/is", $level1[0], $matches);
foreach($matches[0] as $travelzooTitles)
{
echo "<div class='titles' id='travelzooTitles'>".$travelzooTitles."</div>";
}
I'm getting error, but can I even do something like that?
Lets say I have contents like this
<div class="dealsListS">
some contents
</div>
This is where I have the first preg match to get this div tag.
Then I wanted to obtain something within dealsListS
<div class="dealsListS">
<h2>contents</h2>
</div>
Then I wanted to get more inside dealsListS
<div class="dealsListS">
<h2>contents</h2>
<div class="thumbWrapper">images</div>
</div>
I wanted to have different layers because I wanted to output or set these two objects differently. One would be context, other would be images so I can style them however I want to.
Thank you