WordPress.org

Ready to get started?Download WordPress

Forums

creating html fragments, not full pages with wordpress for consumation by extern (4 posts)

  1. chzumbrunnen
    Member
    Posted 2 years ago #

    I need an external app to be able to harvest content of single posts (or maybe posts-lists) as well as parts of the wordpress-generated web-page (all inside the <body>), like header or footer etc.

    For this I need to be able to offer an url where this app can get parts of a page to include in it's own page.

    The app on a different server generates a html page and needs to be able to include elements from my wordpress install, something like this

    <html>
    <head>
    </head>
    <body>
    <div id="header">
    <h2>Anything</>
    include: wordpress-content:
    --> <div class"whatever"><h3>anything</h3></div>
    </div>
    <div>
    include: wordpress-content:
    --> <div class"whatever2"><p>anything</p><p>lorem ipsum...</p></div>
    </div>
    <body>
    </html>

    wherby the classes "whatever" and "whatever2" and all it's content are parts of the regular wordpress output.
    Hope this pseudo-code makes it clear.

    Does anyone have some creative ideas?

    For now I thought of heaving fragments that are around the content as separated files which will be included in the theme files and therefore could be included from an external application just the same way. Of course local paths need to be full urls, but besides that, it shouldn't be that difficult.

    For content blocks itself it should somehow be possible to use a special theme file which only creates the content-block without all the markup around.

    I'm not yet sure how I could define it. Maybe the functionality to create rss/atom feeds could somehow be adapted to create a html-fragment.

    I just would appreciate any ideas or hints or experiences.
    Just brainstorming-like thoughts would help a lot, because there might be much simpler solutions as I'm having in mind now or even some predefines wordpress functions I don't know yet.

  2. Ziv
    Member
    Posted 2 years ago #

    I am not sure if I even understood what you want to do. But to get the content of a post you can run the post loop and place it inside paragraph html tags. Can you find a website that does something like what you are trying to achieve?

  3. chzumbrunnen
    Member
    Posted 2 years ago #

    Well, I think, I have to try a bit before I can get it explained much better.

    I just need to provide an URL (that WordPress generates) where an external tool can get for example a single post. But this external tool doesn't need the whole page but only the fragment (div or whatever) that it should include in it's own page.

    I have something similar but in the other direction realized here:

    http://blog.itil.org/

    Here WordPress is taking the contents of a shop to include it in it's own page:

    In the sidebar on the right, way below, there is a header "NEUE ARTIKEL" and the list is imported from some URL at http://shop.glenfis.ch/

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Perhaps you need to look at integrating WordPress with your web site.

Topic Closed

This topic has been closed to new replies.

About this Topic