Go to Post Given a choice between giving a man a fish and teaching him to fish, you always want to teach them to fish. But sometimes that involves showing him how to put the worm on the hook first. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-03-2003, 23:28
Trashed20's Avatar
Trashed20 Trashed20 is offline
Boom, Shawalala Boom!
#0862 (PCEP Lighting)
 
Join Date: Jan 2002
Location: Canton, MI
Posts: 528
Trashed20 will become famous soon enough
Send a message via AIM to Trashed20
Listen-to xml parsing example thingie

well, i got bored one day and tried some xml parsing based on some examples i found on the web for Listen-to. don't know if anyone is interested. Prolly not very efficient but hey. I basically just made it output an image (which you can already do) but you could do anything you want with the data. comments are good

PHP Code:
<?php
$file
"http://www.listen-to.com/xml.php/trashed20";
$depth = array();
$data1=array();


function 
startElement($parser$name$attrs) {
global 
$name;
    global 
$depth;
    for (
$i 0$i $depth[$parser]; $i++) {}
    
$depth[$parser]++;
}

function 
endElement($parser$name) {
    global 
$depth;
    
$depth[$parser]--;
}

function 
characterData($parser$data) {
global 
$data1;
if (
$data!="    "){$data1[] =$data;}}

$xml_parser xml_parser_create();
xml_set_element_handler($xml_parser"startElement""endElement");
xml_set_character_data_handler($xml_parser"characterData");
if (!(
$fp fopen($file"r"))) {
    die(
"could not open XML input");
}

while (
$data fread($fp4096)) {
    if (!
xml_parse($xml_parser$datafeof($fp))) {
        die(
sprintf("XML error: %s at line %d",
                    
xml_error_string(xml_get_error_code($xml_parser)),
                    
xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);

header ("Content-type: image/jpeg");
$im = @imagecreatefromjpeg ("temp2.jpg"); 
$tc  imagecolorallocate ($im255255255);
$time=date("m/d/y g:i a",$data1[11]);
$track=$data1[7];
$group=$data1[3];
imagestring ($im32307$timeblack);
imagestring ($im312631$groupblack);
imagestring ($im313652$trackblack);
imagejpeg ($im,"",85);
?>
__________________
Where has all the fun gone?

Last edited by Trashed20 : 26-03-2003 at 06:58.
  #2   Spotlight this post!  
Unread 26-03-2003, 00:14
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
very cool.
__________________
Brandon Martus
e-mail
  #3   Spotlight this post!  
Unread 27-03-2003, 00:44
gliebowitz gliebowitz is offline
Registered User
#0075 (RoboRaiders)
 
Join Date: Feb 2003
Location: Hillsborough
Posts: 26
gliebowitz is an unknown quantity at this point
Send a message via AIM to gliebowitz
I'm doing some client work now using "web services" (buzzword) and SOAP to integrate an inventory database with various platforms.

On my team's homepage, XML was used to dynamically feed info to the news system from a simple Access db (Flash and static pages) with ASP... not PHP. http://www.roboraiders.com

How long have you been working with PHP?
__________________
Greg Liebowitz
Programmer/Webmaster
Team 75 - RoboRaiders
www.itmediaco.com

http://www.roboraiders.com
  #4   Spotlight this post!  
Unread 27-03-2003, 07:07
Trashed20's Avatar
Trashed20 Trashed20 is offline
Boom, Shawalala Boom!
#0862 (PCEP Lighting)
 
Join Date: Jan 2002
Location: Canton, MI
Posts: 528
Trashed20 will become famous soon enough
Send a message via AIM to Trashed20
i've been working with php since may of last year. I wrote our whole website ( http://www.lightningrobotics.com ) in php and using mysql. Making xml files to parse for every time someone wants to access your news is prolly pretty hard on your system. Doesn't ASP have dirrect connections to access db's?

I chose php as it is c++ structured and syled which i like
__________________
Where has all the fun gone?
  #5   Spotlight this post!  
Unread 27-03-2003, 15:13
gliebowitz gliebowitz is offline
Registered User
#0075 (RoboRaiders)
 
Join Date: Feb 2003
Location: Hillsborough
Posts: 26
gliebowitz is an unknown quantity at this point
Send a message via AIM to gliebowitz
Cool


A connection is made to an Access db just like you would do for any other ODBC connection. The server we're using is a 1.4 Ghz P3 Dell, so it doesn't seem to get bogged down too often ;-).

If you are interested, this is the code to the asp script requested by the Flash intro to get the latest news:

PHP Code:
var months = new Array ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
var 
monthValue = new Array (13,14,15,16,17,18,19,20,21,22,23,24);
var 
now = new Date();
var 
month now.getMonth();
var 
date now.getDate();
var 
day now.getDay();
var 
year now.getYear();
var 
week 1;
if (
year 2000year year 1900;
var 
monarr = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if (((
year == 0) && (year 100 != 0)) || (year 400 == 0)) monarr[1] = 29;
sday day;
while (
date != 0){
date --;
sday --;
    if (
sday 0){
        
sday sday 7;
        
week ++;
    }
}
var 
currentMonth months[month]
var 
currentWeek week
var current_category monthValue[month]
var 
out
sql 
"SELECT * FROM data where data_category = " current_category " order by data_subcategory, data_name";
rs Server.CreateObject("ADODB.RecordSet");
rs.Open (sqlConn2,3);
if (
rs.EOF){     // check to see if rs is empty
out += ('    <button name="No articles">\n')
out += ('        <info>There are no new events for this week.</info>\n')
out += ('    </button>\n')
}
else{            
// rs not empty

    
temp_subcat""//this string used to group records by subcategory
    
fields = new Object(); // this object used to store fields in records

while (! (rs.EOF)){

    
// clean up data and put it into the fields object:
    
for ( field_number 0field_number rs.fields.count field_number++ )
        {
        
temp_field String(rs.fields(field_number).Name);
        
temp_content String(rs.fields.item(temp_field));
        
temp_content temp_content.replace(/&#039;/g,"'");
        
if (temp_field.search(/date/) > )     // check for date fields
            
{temp_content slash_date(temp_content);} 
        else if (
temp_content == "null") {temp_content ""; }
        
fields[temp_field] = temp_content
        
// end looping through fields in current record

        // subcategories: when we get to a new one, display it
        
if (temp_subcat != fields.data_subcategory){
            
temp_subcat fields.data_subcategory;
        }
if (
temp_subcat == currentWeek){
            
out += ('   <data>\n')
            
out += ('    <name>'+fields.data_name+'</name>\n')
            
out += ('    <info>'+fields.data_url+'</info>\n')
            
out += ('    <id>'+fields.data_uid+'</id>\n')
            
out += ('   </data>\n')
        } else {
}

        
rs.move(1);
        } 
// end while recordset
     // end else (rs not empty)
rs.Close ();
}
if (
out==""){
            
out += ('   <data>\n')
            
out += ('    <name>No articles.</name>\n')
            
out += ('    <info>There are no new events for this week.</info>\n')
            
out += ('    <id>undefined</id>\n')
            
out += ('   </data>\n')
}
Response.Write(out)
Conn.Close (); 
__________________
Greg Liebowitz
Programmer/Webmaster
Team 75 - RoboRaiders
www.itmediaco.com

http://www.roboraiders.com
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Parsing Jack FIRST Scouting Network 1 12-10-2003 13:36
XML And Link Raven_Writer Website Design/Showcase 13 26-09-2003 17:24
xml Jack FIRST Scouting Network 0 01-09-2003 16:23
[Tech] - XML Parsing Jack FIRST Scouting Network 3 20-05-2003 16:42
Does FIRST listen to teams? archiver 2001 5 24-06-2002 04:01


All times are GMT -5. The time now is 00:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi