bftwofreak Posted August 8, 2008 Share Posted August 8, 2008 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. Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 8, 2008 Share Posted August 8, 2008 it can search through html, but I don't see why you don't just use something like ereg() or strstr() here. Also, if $top_medals is a class, I doubt preg_match can deal with it as a string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.