How to Display Text from one webpage on Another?

11 replies
How do you feed a snippet of text from one webpage to another? Sort or like the same way you do with an image?

What I mean is, we can use an image from one webpage to display on another webpage. Is there a way I can do that with a block of text as well?

The reason why I would like to find out how to do this is so that if I use the same particular paragraph of words on lets say 5 pages, I would only need to edit it on one page, and it will update on the other 4 pages.

No I am not talking about CSS. I would like to use any block of text from any webpage to show up on another just like the way images do. I was wondering what way can I do this?
#display #text #webpage
  • Profile picture of the author rodvdka
    The easiest way to do this would be server side, in PHP for example, although this will be slow.

    Client > Your Server > Other Site Server > Your Server > Client versus

    Client > Your Server > Client.

    You could also use Javascript and AJAX (jQuery) to access the text and display it although most browsers will fail to do this unless you own the site and have set up CORS (Cross origin resource sharing). If you are going to use the snippet, rather periodically scrape it, put it into a database, then call it on your website.
    {{ DiscussionBoard.errors[8417019].message }}
    • Profile picture of the author MindReality
      Originally Posted by rodvdka View Post

      The easiest way to do this would be server side, in PHP for example, although this will be slow.

      Client > Your Server > Other Site Server > Your Server > Client versus

      Client > Your Server > Client.

      You could also use Javascript and AJAX (jQuery) to access the text and display it although most browsers will fail to do this unless you own the site and have set up CORS (Cross origin resource sharing). If you are going to use the snippet, rather periodically scrape it, put it into a database, then call it on your website.
      Is it possible to do something like that on WordPress? Say... have a paragraph from one post displayed on 5 other posts?
      Signature
      Discover The Greatest Secrets Of The Mind And Reality That Will Get You Anything You Desire, Almost Like Magic! Visit: http://www.MindReality.com
      {{ DiscussionBoard.errors[8417151].message }}
      • Profile picture of the author rodvdka
        Originally Posted by MindReality View Post

        Is it possible to do something like that on WordPress? Say... have a paragraph from one post displayed on 5 other posts?
        Yes, although I'm not a Wordpress power user, this should be quite easily done. I'm sure Wordpress has a snippets functionality.
        {{ DiscussionBoard.errors[8417200].message }}
        • Profile picture of the author MindReality
          Originally Posted by rodvdka View Post

          Yes, although I'm not a Wordpress power user, this should be quite easily done. I'm sure Wordpress has a snippets functionality.
          I hope someone knows of a plugin, or php method to do that on Wordpress

          Also, how do I use iFrame to get a particular block of text instead of the entire webpage?
          Signature
          Discover The Greatest Secrets Of The Mind And Reality That Will Get You Anything You Desire, Almost Like Magic! Visit: http://www.MindReality.com
          {{ DiscussionBoard.errors[8417240].message }}
  • Profile picture of the author David Beroff
    Originally Posted by MindReality View Post

    The reason why I would like to find out how to do this is so that if I use the same particular paragraph of words on lets say 5 pages, I would only need to edit it on one page, and it will update on the other 4 pages.
    I think you are asking about the case where you control all of this content. What I do is simply use PHP's require control structure to bring in the common text into any page. This is also very helpful to ensure that the top and bottom of every page are identical.
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[8417195].message }}
  • Profile picture of the author stonecoldmf
    There are many ways to do it, you can use session or cookies to transfer page variable from one page to another or even you can use form methods to do it if you are having a form but the best way to do it is a session or query string whcih can be passed with the url of the page.
    {{ DiscussionBoard.errors[8539715].message }}
    • Profile picture of the author bptsolution
      Depends what you mean by "any web page". If they all belong to you, and contain nothing but text then yes - very possible and easy. Iframe if you must, or else use a server side language to get the file contents.If you are trying to take particular snippets from any random page, then it becomes much harder as you must open and search each page to get the content.
      {{ DiscussionBoard.errors[8543314].message }}
  • Profile picture of the author webzie
    You can use either session or cookies for such requirements and it depends on what language you are using you should code accordingly
    {{ DiscussionBoard.errors[8568765].message }}
    • Profile picture of the author rhinocl
      There has been at least one wp plugin with the word snippets or snippet in it. You should check it out.
      {{ DiscussionBoard.errors[8570267].message }}
      • Using your analogy of an image.

        The image lives on a server and you can reference the image from any page you wish the image to appear on.

        To do the same in a php page or a wordpress page there are two main methods that will work.

        You can use a database to hold your text and pull the text from any page you like.

        Or you can use a text file to hold your text, then you can use include to pull it in, or you can open the file and "read" the text out then echo it out to your page.

        In word press you have get_option that will pull a field from the wordpress database. set_option would set it.

        Good Luck
        {{ DiscussionBoard.errors[8570549].message }}

Trending Topics