Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How can I feed content from one webpage into another??

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #40159
    rosco
    Participant

    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

    #111378
    mweldan
    Member

    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

    #111383
    Dhanishta
    Member

    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.

    #111385
    rosco
    Participant

    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

    #111481
    mweldan
    Member

    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.

    #111511
    rosco
    Participant

    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?

    #111516
    mweldan
    Member

    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.

    #111524
    rosco
    Participant

    Thanks that’s a great help.

    Ross

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Back End’ is closed to new topics and replies.