PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



Import Text File

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General
View previous topic :: View next topic  
Author Message
wverbist



Joined: 08 Oct 2007
Posts: 1
Location: New Jersey

PostPosted: Mon Oct 08, 2007 4:38 am    Post subject: Import Text File Reply with quote

Hi. I am new to PHP development and I am working on a very small project right now that I thought would be the perfect place for me to dive in and learn. So far, so good but the question I have is about importing a .txt file. I have the file importing properly and the CSS is applying properly but what I want to know is how to have a single .txt but attach variables to certain lines to just pull data from that section. This is hard to describe so here is the link to the page that I am working on:

http://www.williamverbist.com/_ethno/ethnic_spring.php

The area I am referring to is the Title(s) and product description. Is there a way that all of that data can be in a single text file but by adding varibles or arrays to lines that when you click on one of the circles to see another product that the copy area will change as well? I work a lot in Flash and have done that there many times but was not sure if it is possible with just PHP or do I actually need to build a small MySQL database? Since there will not be a ton of data here, I was trying to keep this as simple as possible.

Any help would be appreciated. Thanks.
Back to top
View user's profile Send private message
lostboy



Joined: 02 May 2004
Posts: 6059
Location: toronto, canada

PostPosted: Tue Oct 16, 2007 3:23 am    Post subject: Reply with quote

That took a few rereads to make sense of what you really wanted. You are using the text file as the data source and you want to change the presentation based on something clicked on the client...

If that is correct, you can do something similar, but if you want the same user experience, you will need to use AJAX, otherwise you will need to reload the page each time.

You can simulate this by reading the file into an array, assuming that each line is the complete elements list of for one record. Then you can show the user some piece of that array as the item...when the user clicks the link, you do an AJAX call to the server, repeat the same page that you used to do the initial html, passing in the parameter of the element that you want. The parameter likely to the index element of the array that would hold the data.
Back to top
View user's profile Send private message Send e-mail AIM Address MSN Messenger
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



Post new topic   Reply to topic    WeberForums.com Forum Index -> PHP General All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum