There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Dynamically Pull Text from one page onto another


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
bigthink's Avatar
Junior Member with 9 posts.
 
Join Date: Aug 2005
25-Jul-2006, 03:49 PM #1
Dynamically Pull Text from one page onto another
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
kbazsi's Avatar
Member with 31 posts.
 
Join Date: Mar 2006
Location: Romania
Experience: Intermediate
25-Jul-2006, 04:15 PM #2
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.
covert215's Avatar
Account Disabled with 2,651 posts.
 
Join Date: Apr 2006
Experience: Web Designer
25-Jul-2006, 06:14 PM #3
you can INCLUDE the file
thecoalman's Avatar
Computer Specs
Distinguished Member with 2,503 posts.
 
Join Date: Mar 2006
Location: Pennsylvania
Experience: What's the shiny red button for? <click>
26-Jul-2006, 12:04 AM #4
Quote:
Originally Posted by bigthink
I've seen this done in forums where they show the most recent posts and then it has a snippet of the new posts.
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.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:02 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.