Hello,
I have a text with a lot of html tags like <p><strong> etc
heres what i want to do:
I need to count the number of words that are in the first <p> </p>, if he words are more than or equal to 50 then I rewrite the first <p> with <p class="myClass"> if less than 50 words then the first <p> should be <p class="myClass"> AND second <p> tag should be <p class="MsoNormal myClass">
Please note that it should strip any and all other tags out from the text.
(P.S Is there any way to enter the whole question in one page on EE instead of going step by step?)
This is how far i have come:
I dont know how to catch the first <p> ... </p> block but after catching it
1.use strip_tags() to take out all inside tags (problem is, this will also take out the <p> tags :(
2. explode() it and use count() to count the words
What do you think? Please reply with code that I can test and use
Start Free Trial