View Single Post
Old 09-13-2005, 04:16 PM   #1
mdavila
Green Mole
 
Join Date: Feb 2005
Posts: 11
Extracting H2 tag

Hi,

I have added the code you suggested to the robot_functions.php to pull the h2 tag instead of the title tag. It works but the problem is that it is pulling both the first and second h2 tags.

This is the code i pasted in:

//extracts title
if (preg_match_all('/< *h2 *>(.*?)< *\/ *h2 *>/is',$text,$regs,PREG_SET_ORDER)) {

// assumes there are at least three h2 tags
$title = trim($regs[0][1]." ".$regs[1][1]." ".$regs[2][1]);
}
else {
$title = "";
}

The results is showing " Contact UsContact Us"

On this page there are 2 h2 tags. http://dobleweb1.doble.com/contactus/ but i only want to show the second one.

Any suggestions?

Thanks,

-Marc
mdavila is offline   Reply With Quote