Grow your CSS skills. Land your dream job.

How can I feed content from one webpage into another??

  • # October 5, 2012 at 4:12 am

    Hi Guys,

    How would I go about feeding content from one webpage into another?

    I want to create a Staff Directory that displays a thumbnail image of members of staff and also the first say 20 words of each staff members’ profile.

    I want to know if there is a way of feeding this content into the Staff Directory, so that I when one page is updated, it automatically updates the Staff Directory?

    Any ideas?

    Ross

    # October 7, 2012 at 4:54 am

    it is hard to understand what you want to achieve.

    content is stored in database or flat file?

    is this general php problem or you’re asking how to build thing in wordpress?

    if wordpress, check out how to make template file.

    if the question is general problem, check out how to store item into database

    # October 7, 2012 at 12:20 pm

    In wordpress prospective:
    Pages are just posts, with a post_type of ‘page’ in the database. You can show the content of multiple pages on another page by writing a post query in your pageX template that gets the posts you specify and output them in a Loop.

    There are three ways to get post content from the database:

    get_posts,
    query_posts,
    WP_Query.

    These links all point to the WordPress Codex. Get_posts and query_posts have an argument available, ‘page_id’, where you can specify the id of the page you’d like to retrieve and display.

    # October 7, 2012 at 1:47 pm

    Hi sorry if I’ve caused confusion. It is not a WordPress site that I am referring to. It’s just a regular HTML/CSS website.

    To clarify what I am trying to do, I’ll use an example…

    I have a web page with a list of products with a small thumbnail image and the a short summary of text beside each product. Each product has its own web page with a larger image and a full product description.

    What I want to know is if it is possible to feed content from each product’s page, to the main page containing the full list of products. So I can display the first sentence of each product and a thumbnail version of the large image.

    Does this make more sense?

    I have heard of something called cURL that can achieve this but I don’t know anything about it.

    Thanks,

    Ross

    # October 9, 2012 at 3:51 am

    sure you can. if all of this web pages are on same host i think you don’t need curl.

    perhaps an easy way to do this is:

    put id or class on each element you want to be appear in other page .

    with javascript you can fetch it. i prefer jQuery. we are talking about AJAX here if you’re concern.

    # October 9, 2012 at 8:01 am

    Thanks for the reply. Do you know if by using Fetch you can manipulate content? For instance fetching only the first 20 words of content from a div, or can you only fetch an entire div or url?

    # October 9, 2012 at 8:14 am

    you can do something like this :

    http://api.jquery.com/load/

    http://api.jquery.com/category/traversing/

    from there you are free to process it any way you can.

    # October 9, 2012 at 11:11 am

    Thanks that’s a great help.

    Ross

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".