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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.