Search for H1 Tag


#1

Hi,

I am a real php newb :)

I want to be able to add some php to my pages to allow me to find the href attribute for a

tag above the php.

Does anyone know how I could achieve this?

Thanks

Ricky


#2

tags don't have href attributes ;) I think this is pattern matching, and regex would be first-choice.


#3

I have no idea what you are talking about so I will give you more detail.

I want a php file to be able to find the href in the following

<h1><p class="underheading"><a href="http://augmentia.110mb.com/firefox_better_browser.php">5 reasons firefox is a better browser</a>

Thanks
Ricky


#4

Okay, first of all, get some knowledge on HTML, PHP, the difference between tags and attributes. Then learn regex, what it is, what it does and how you could put it to good use. HTML isn’t that hard, PHP is harder and regex is even harder to understand and learn. But unless you’re a serious masochist, regex is the only way to filter out anchor tags from HTML chunks.


#5

im sorry you misunderstood me. I have an ok knowledge of html (I know that h1 tags dont have links) But I have little php experience.

Though I will look into Regex.

Thanks

Ricky


#6

Regex is pretty complex… I think I can tell it to search for the href attribute after the h1 tag, but I am not sure how to include this in a php statement?

Any Ideas?

Ricky


#7

How about preg_match or preg_replace? Wouldn’t either of those be good?


#8

dw about it…

I decided to switch to wordpress… it does it for me!