User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,802 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1437 | Replies: 11
Reply
Join Date: Oct 2007
Posts: 6
Reputation: ramirez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramirez ramirez is offline Offline
Newbie Poster

Parse html

  #1  
Oct 3rd, 2007
Hi all.

I have an application were a user fitt (outside the game) a "ship" and after the full fitt he can save that in a doc file.

In that file we'll see 4 fields with vari lines in each of them (not the same fitt for all the ships).

I want to create a form where you paste the entire content of the file and submit. That will be placed in mysql database. There is a page were the users can search a ship and he will see all the fittings availble for the ship he selected on a webpage.

Can anyone help me get this thing going ?

Would be much apriciated if someone could help me.

Example of the file:

Item 1 Low Slot
Item 2 Low Slot
Item 3 Low Slot

Item 1 Med Slot
Item 2 Med Slot
Item 3 Med Slot
Item 4 Med Slot

Item 1 High Slot
Item 2 High Slot
Item 3 High Slot
Item 4 High Slot
Item 5 High Slot

Item 1 Rig Slot
Item 2 Rig Slot
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Parse html

  #2  
Oct 5th, 2007
i think i can help you, but please explain it in more detail. what is a "fitt", maybe fitting i don't know. just please be more clear. what exactly are you trying to do or what are you even saying, "fitt", "full fitt", ????????
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: ramirez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramirez ramirez is offline Offline
Newbie Poster

Re: Parse html

  #3  
Oct 5th, 2007
Hi Keith

Fitt is for "Fitting".

I play a game were we have ships and need to br fitted with some equipment.
We have a 3party tool that give us the possibility to "test" some fittings (when you drag the modules into the shipp it gives the stats of battle and ship endurance).

After fitting you can copy the fitting and paste were ever you want.
I would like to make a page so the members of my corp can share some info.

1 - They would paste the info in some kind of form and when submited it drops the info in a mysql;
2 - In a search page they will get a result according to their needs.
Reply With Quote  
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation: kkeith29 is on a distinguished road 
Rep Power: 3
Solved Threads: 72
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Practically a Master Poster

Re: Parse html

  #4  
Oct 5th, 2007
all of that is not hard, and will only take maybe an hour. what i need from you: mysql table name, fields of that table. Also, what exactly are they going to be putting into the database. just show an example thats all i need.
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: ramirez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramirez ramirez is offline Offline
Newbie Poster

Re: Parse html

  #5  
Oct 5th, 2007
Medium Armor Repairer II
Reactor Control Unit II
Power Diagnostic System II
Adaptive Nano Plating II
Reactor Control Unit II

Cap Recharger II
Cap Recharger II
Cap Recharger II

Medium Nosferatu II
Medium Nosferatu II
Medium Nosferatu II
Medium Nosferatu II

Anti-Thermic Pump II
Anti-Kinetic Pump II

_____________________

This is one example of a fitting created in the program. This is what I'v got to copy/paste.
The first 5 lines represent the low-slot of the ship, the next 3 the mid-slot, the other 4 are the high-slot and the last 2 are the rig-slot.
The number of lines per slot are diferent from ship to ship.

The user should copy the file (like the one above) and paste it to a form, he also need to give a name to the fitting (on another field).

The field of the table should be something like:

ID;
Ship; (this one the real name of the ship from the game)
Fitting;
Date; (optional)
Reply With Quote  
Join Date: Aug 2005
Posts: 4,832
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 324
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: Parse html

  #6  
Oct 6th, 2007
All this is, is basic parsing of information and separating it into their relevant fields. What don't you get?
Last edited by iamthwee : Oct 6th, 2007 at 9:07 am.
... the hat of 'is this a cat in a hat?'
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: ramirez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramirez ramirez is offline Offline
Newbie Poster

Re: Parse html

  #7  
Oct 6th, 2007
Originally Posted by iamthwee View Post
All this is, is basic parsing of information and separating it into their relevant fields. What don't you get?


I know that is just parsing. The problem is that the text don't have fixed fields.
The text change from fitting to fitting, ex:

Fitting 1:

Medium Armor Repairer II
Reactor Control Unit II
Power Diagnostic System II

Cap Recharger II
Cap Recharger II

Medium Nosferatu II
Medium Nosferatu II
Medium Nosferatu II

[empty rig slot]

Fitting 2:

Medium Armor Repairer II
1600mm Reinforced Titanium Plates I
Energized Basic Adaptive Nano Plating
Magnetic Field Stabilizer II
Partial Power Plant Manager: Capacity Power Relay
Type-D Power Core Modification: Capacitor Power Relay

Heavy Capacitor Booster II
Sensor Booster II
Magnetic Scattering Amplifier II
100MN Afterburner II

[empty high slot]
Neutron Blaster Cannon II
Neutron Blaster Cannon II
Neutron Blaster Cannon II
Neutron Blaster Cannon II
Neutron Blaster Cannon II

[empty rig slot]
[empty rig slot]

As you can see I have here 2 diferent fittings for 2 diferent ships. How can I parse this?
Reply With Quote  
Join Date: Jul 2004
Location: North East Indiana
Posts: 491
Reputation: Puckdropper is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 20
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: Parse html

  #8  
Oct 7th, 2007
What you'd have to do is make sure the patterns exist for each input file (they don't have to be strict patterns, just a standard format) and then parse your files off of that. If you don't have any patterns to match, you've got a situation where you're trying to do human-level comprehension. That's way beyond the average PHP program.
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote  
Join Date: Oct 2007
Posts: 6
Reputation: ramirez is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ramirez ramirez is offline Offline
Newbie Poster

Re: Parse html

  #9  
Oct 7th, 2007
As you can see in my last post, none of the previous texts had a fixed line.
Each line represents a item and each blank line represents a change in the type of slot used.

I know that this is difficult to do. My hope was that I could parse the text to use a DB, that I have, of the items.
Reply With Quote  
Join Date: Jul 2004
Location: North East Indiana
Posts: 491
Reputation: Puckdropper is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 20
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: Parse html

  #10  
Oct 7th, 2007
Take a moment and look at what will always be the same in your file.
1. Are the "fittings" from a standard set?
2. Is each blank line guaranteed to be there?
2a. What about line endings? (Does an EOL mean end of item slot?)
3. Can "fittings" go in a different place on your "vessel" or are they one position only?
3a. If they can go multiple places, does the order of the list matter?
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 4:13 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC