Jump to content

php preg_match searching within html tags


bftwofreak

Recommended Posts

Can preg_match search within html tags? Here's my code:

/* Top Medal 4 */
if (preg_match('ctl00_mainContent_rptMedalRow_ctl00_rptPlayerMedals_ctl04_imgGameMedal',$top_medals) == 1) {
$top_medal4 = $top_medals->find('div[class=medal_matte]', 3);
if ($top_medals->find('div[class=title]', 3)->innertext == '-') {
	$top_medal4_name = '';
	$top_medal4_img = '';
	$top_medal4_num = '';
} else {
	$top_medal4_name = $top_medals->find('div[class=title]', 3)->innertext;
	$top_medal4_img = '<td style="' . $medal_style . '"><img src="http://www.bungie.net' . $top_medal4->find('img', 0)->getAttribute('src') . '" alt="' . $top_medal4_name . '" /></td>';
	$top_medal4_num = '<th style="' . $medal_style_num . '">' . $top_medals->find('div[class=num]', 3) . '</th>';
}	
}

The "ctl00_mainContent_rptMedalRow_ctl00_rptPlayerMedals_ctl04_imgGameMedal" is the id of an image, but it won't process properly when I load the page. oh and there are two more medal table cells before it, but they're always visible. I want this one to show up only when it is there.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.