WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PhP Parse stgin from post (13 posts)

  1. zzuum
    Member
    Posted 8 months ago #

    Hello,

    i want to find all <h2> tags in my post and put it i one array...

    (I need all sentence with h2 tags, from post)

    Thank you.

  2. Andrew
    Forum Moderator
    Posted 8 months ago #

  3. zzuum
    Member
    Posted 8 months ago #

    Thank you for answer..but i need something more precision.. :)

  4. Andrew
    Forum Moderator
    Posted 8 months ago #

    In the bigger picture do you think JavaScript is more suitable for what you're doing?

  5. zzuum
    Member
    Posted 8 months ago #

    well maybe.. do you have some example with JavaScript..?

  6. Andrew
    Forum Moderator
    Posted 8 months ago #

    What is it you're trying to do?

  7. zzuum
    Member
    Posted 8 months ago #

    I want use all sentences from post that have <h2> tag... and then print them..

    example :
    new post

    <h2>title1</h2>
    text1
    <h2>title2</h2>
    text2
    <h2>title3</h2>
    text3

    and now i need that titles from post.

    Here is picture : http://i42.tinypic.com/so1n5e.png
    That <h2> i want.

  8. Andrew
    Forum Moderator
    Posted 8 months ago #

    Print them in the same post?

  9. zzuum
    Member
    Posted 8 months ago #

    i need to print them here : http://stefanvblog.com/category/top5/

    but if you can't that.. is ok in the same post too :)

  10. Andrew
    Forum Moderator
    Posted 8 months ago #

    Is the title of the post is explicitly set in '<h2>' tags and not the actual post title outlined here: http://snag.gy/oZJWP.jpg ?

  11. zzuum
    Member
    Posted 8 months ago #

    No, i don't need title of post.. I need text in the post that has h3 tag

    Here is image : http://i42.tinypic.com/so1n5e.png

  12. Andrew
    Forum Moderator
    Posted 8 months ago #

    I think you're going to need to convert your HTML string into a DOM object http://stackoverflow.com/questions/5126967/extract-dom-elements-from-string-in-php

  13. zzuum
    Member
    Posted 8 months ago #

    woow.. all html .. :S .. is there any easier way

Reply

You must log in to post.

About this Topic