1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Dynamically Pull Text from one page onto another

Discussion in 'Web Design & Development' started by bigthink, Jul 25, 2006.

Thread Status:
Not open for further replies.
Advertisement
  1. bigthink

    bigthink Thread Starter

    Joined:
    Aug 24, 2005
    Messages:
    9
    OK. I need to know how I can grab some text from Page A and include it on Page B.

    I'm sure there is a way to do it with PHP but I have no idea where to start. I'm familiar with using include statements but how can I specify which text, say the first line, to put on the new page.

    So you understand what I'm doing: Page A will have a the full article. Page B will have a link to Page A but there needs to be a small snippet of the full article from Page A as a teaser. I've seen this done in forums where they show the most recent posts and then it has a snippet of the new posts.

    But how can I do it?

    THANKS IN ADVANCE!

    Stacy
     
  2. kbazsi

    kbazsi

    Joined:
    Mar 3, 2006
    Messages:
    31
    The first question is that both pages (A and B) are yours?
    If yes, then the articles should be in a database and from there it's easy to get the first x line/word/char.
    If no then the site from where you want to get the data has a good structure, can you find a code snippet in the source of the page, just before the article, what is there in every page, and only before an article?
    Look for the fopen() or fsockopen() functions. After that you only have to parse the file.
     
  3. covert215

    covert215 Banned

    Joined:
    Apr 22, 2006
    Messages:
    2,595
    you can INCLUDE the file
     
  4. thecoalman

    thecoalman

    Joined:
    Mar 6, 2006
    Messages:
    2,491
    Are you trying to pull text from a forum or a database? Phpbb has a mod for that, actually two that I can think of.

    Sounds to me like you're trying to pull the text form an existing HTML document? The difference between that and the forum example you describe is the text resides in the database, it doesn't contain any html. The way you are approacing it you'd have to strip the html from the original and snip the text, possible I'm sure but in my semi-newbie opinion I think you're approching it wrong. I'd place the article in a database then pull it from there to whatever page you want.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/486319

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice