erutufon|nofuture  

FAQ Members List Calendar Mark Forums Read
Go Back   erutufon|nofuture > erutufon central
User Name
Password

Reply
 
Thread Tools SEARCH THIS THREAD Display Modes
Old 4th January 2010   #1
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
php whizz'

anyone here uber proficient, willing to give some pointers? thanks in advance
bigus is offline  
 :: quote post ::
Old 4th January 2010   #2
decadnids
solve et coagula
 
decadnids's Avatar
 
Join Date: Jan 2003
Location: sussex
Posts: 6,095
I do php development - what's your question?
decadnids is offline  
 :: quote post ::
Old 4th January 2010   #3
Algy
(untitled)
 
Join Date: May 2008
Location: Liverpool
Posts: 114
Aye - fire away
Algy is offline  
 :: quote post ::
Old 8th January 2010   #4
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
yeah im having trouble basically getting php to connect to the xml and give me a result. does that make sense?
bigus is offline  
 :: quote post ::
Old 8th January 2010   #5
Spandex
Very Bad Dog
 
Spandex's Avatar
 
Join Date: Jan 2004
Location: Nottingham
Posts: 8,428
Not massively Moar details.





...........................
lovely cloakroom. lovely cloaks - barbam nondum video
Spandex is offline  
 :: quote post ::
Old 8th January 2010   #6
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
Okay, I've one page of PHP and one page of xml with "content" on it. When i click on the link. The PHP page cuts off the content from the xml page - ie it gives only partially the content of the tags- does that help, obviously learning to code
bigus is offline  
 :: quote post ::
Old 8th January 2010   #7
Spandex
Very Bad Dog
 
Spandex's Avatar
 
Join Date: Jan 2004
Location: Nottingham
Posts: 8,428
I think you need to be a bit more basic in your description.. you're not really saying what you're doing.

You have a PHP page which does something? Prints something?

You have some XML. In an XML file? Or being printed by PHP? Are you trying to load the XML in PHP? etc.

Don't be shy of spelling it out as if you're talking to somebody's granny... programmers don't mind that shit

edit: and post any example bits that aren't confidential etc.. that's gonna be very useful





...........................
lovely cloakroom. lovely cloaks - barbam nondum video
Spandex is offline  
 :: quote post ::
Old 8th January 2010   #8
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
okay so im learning ths stuff in school.
nothing is confidential yet- ha.

below is my master piece so far . also I need to build a ready reckoner. thanks Spandex, et al

http://student.dcu.ie/~kehoew3/PHPte...?article=sport
bigus is offline  
 :: quote post ::
Old 8th January 2010   #9
Spandex
Very Bad Dog
 
Spandex's Avatar
 
Join Date: Jan 2004
Location: Nottingham
Posts: 8,428
So you're reading in some XML file with the content in and then showing different bits of it depending on the URL parameter? e.g. article=sport or article=news or wotever?

And what is it that isn't working?

edit: and pasting examples of your actual code in here is wot we need... just seeing it online doesn't help that much.. cos we just see the end result.. and we need to know how it got there.





...........................
lovely cloakroom. lovely cloaks - barbam nondum video
Spandex is offline  
 :: quote post ::
Old 8th January 2010   #10
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
okay so the content is way longer - but it only shows what's in the tags

#!/usr/dist/bin/php
php - code

if( ! ($fp = fopen( "./sponsor1.xml" , "r" )) )
die("Couldn't open xml file!");
$person_counter = 0;
$person_data = array();
$xml_current_tag_state = '';
function startElementHandler( $parser, $element_name, $element_attribs )
{
global $person_counter;
global $person_data;
global $xml_current_tag_state;
if( $element_name == "STORY" )
{
$person_data[$person_counter]["author"] = $element_attribs["AUTHOR"];
}
else
{
$xml_current_tag_state = $element_name;
}
}
function endElementHandler( $parser, $element_name )
{
global $person_counter;
global $person_data;
global $xml_current_tag_state;
$xml_current_tag_state = '';
if( $element_name == "STORY" )
{
$person_counter++;
}
}
function characterDataHandler( $parser , $data )
{
global $person_counter;
global $person_data;
global $xml_current_tag_state;
if( $xml_current_tag_state == '' )
return;
if( $xml_current_tag_state == "STORYTYPE" ) {
$person_data[$person_counter]["storytype"] = $data;
}

if( $xml_current_tag_state == "HEADLINE" ) {
$person_data[$person_counter]["headline"] = $data;
}
if( $xml_current_tag_state == "ABSTRACT" ) {
$person_data[$person_counter]["abstract"] = $data;
}
if( $xml_current_tag_state == "BODYTEXT" ) {
$person_data[$person_counter]["bodytext"] = $data;
}
}
if( !($xml_parser = xml_parser_create()) )
die("Couldn't create XML parser!");

xml_set_element_handler($xml_p arser, "startElementHandler", "endElementHandler");
xml_set_character_data_handler ($xml_parser, "characterDataHandler");
while( $data = fread($fp, 4096) )
{
if( !xml_parse($xml_parser, $data, feof($fp)) )
{
break; // get out of while loop if we're done with the file
}
}
xml_parser_free($xml_parser);
?>







Shades of Techno




shades of techno




click on the links to navigate




$article = $_GET['article'];

echo $article;

//////////////////////////////////////////////////
for( $i=0 ; $i < $person_counter ; ++$i )
{
$thisName = $person_data[$i]["storytype"];

if ($thisName == $article) {
echo "we have match at position number: ". $i . "
";
$thisPos = $i;
}
}
echo "";
echo $person_data[$thisPos]["headline"];
echo "
";
echo "
";

echo $person_data[$thisPos]["abstract"];

//////////////////////////////////


?>


bigus is offline  
 :: quote post ::
Old 8th January 2010   #11
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
xml page

its still a work in progress so its semi babbling rubbish




sport
Sakamoto and Fennesz make good on their promise with Cendre
Minimalist piano superstar Sakamoto and Ambient noisenic Fennesz team up to deliver contener for album of the year.
For fans of Murcof, Claro Intellecto's quieter moments and Remote. When you graduate from the clicks and cuts school of Mille Plateaux your in the land of classical minimalism .This is where older clubbers go to chill out. This could be played on RTE lyric FM,if only it had a modern programming emphasis, but hey don't let that put you off. Highly recommended as a logical progression from Eno's Ambient series. We can presume that because your here on this site you enjoy quality music ,with an experimental side without sacrificing beauty. Having previously worked together on some live shows, the two heavy weights R Sakamoto and Christian Fennesz finally deliver a stunning full length album "Cendre". Mixing Sakamoto's signature piano work and classic Fennesz production ('Venice') 'Cendre' feels like the perfect meeting of minds. Sakamoto's haunting motifs are wrapped up in sheets of harmonic noise, but they never become overwhelming - rather this is an album which revolves around subtlety and attention to detail. There is one track 'trace' which is slightly unnerving dark ambience but no where near the fear enducing sounds of Rook Vallard. This album oozes Zen and calm. The sort of music you wish was playing during a massage, yet somehow never is. It is perfect baby music, this album has been sending my 11 month old daughter to sleep for some months now. A gorgeous album, and without a doubt one of the most beautiful records you'll hear.. .




news
Two Lone Swordsmen
MOVE over gnomes of Zurich. Irish leprechauns with pots of gold are ready to take your place on Europe's rich list. According to latest figures, the Irish are now as rich as the Swiss. Our wealth has soared from the lowest in the EU in 1973 to the second highest - judged, that is, by the measure of Gross Domestic Product (GDP) per person.
When it comes to music Lord Sabre Mr. Weatherall has "forgotten more, than most people know". Here working with Keith Tenniswood in their Two Lone Swordsmen guise. 'Emitions Audio Output - From The Archive volume 1. This is rather a splendid collection of Two Lone Swordsmen tracks cataloging their mid to late Ninties tracks before they abandoned their deep house leaning for straight up dancefloor electro.Culled mostly from the 'Swimming Not Skimming' and `Stockwell Steppas' ep's Their influence can't be underestimated and this has got some real gems on it. This comp is a neat bookend to their work up to the fantastic 'Tiny Reminders' album. From Dub and Ambient through to Techno and Electro with tracks llike 'Paisley Dark',Their homage to Prince's 'Paisley Park' label, 'Bim,Jack,and Florence', 'Rico's Helly' and 'Spraycan Attack' you get a real sense of how tidy Weatherall and Tenniswood's history has been. The Omid Nourizadeh AKA 16B remix of 'Rico's Helly' alone is worth the price of admission. Essential listening for fans or a great jump off point for the new listener. A worthy addition to any record collection..


cinema
The Lord of the Rings: The Two Towers
Dec 16th: We're all doomed: fear and loathing on the road to Mordor
Wftly dispel the magic.
What are the Ents going to look like? That's the anticipatory cringe for any Tolkien fan faced with a film version of The Two Towers. The corresponding question in The Fellowship of the Ring – how on earth will they tackle wacky old Tom Bombadil? – was dealt with by simple excision, but the Ents are too central to the story to omit. It's perfectly possible to read The Lord of the Rings believing in Treebeard without ever having visualised him (is he an anthropomorphic tree, or a dendromorphic man?). There are a controlled number of humorous situations in this mostly very grim film, but any whiff of whimsy or silliness, like a fart at High Mass, would swim







bigus is offline  
 :: quote post ::
Old 8th January 2010   #12
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
xml page

its still a work in progress so its semi babbling rubbish, ach crap - if you qoute this post you'll see the code - but you prolly knew already.




sport
Sakamoto and Fennesz make good on their promise with Cendre
Minimalist piano superstar Sakamoto and Ambient noisenic Fennesz team up to deliver contener for album of the year.
For fans of Murcof, Claro Intellecto's quieter moments and Remote. When you graduate from the clicks and cuts school of Mille Plateaux your in the land of classical minimalism .This is where older clubbers go to chill out. This could be played on RTE lyric FM,if only it had a modern programming emphasis, but hey don't let that put you off. Highly recommended as a logical progression from Eno's Ambient series. We can presume that because your here on this site you enjoy quality music ,with an experimental side without sacrificing beauty. Having previously worked together on some live shows, the two heavy weights R Sakamoto and Christian Fennesz finally deliver a stunning full length album "Cendre". Mixing Sakamoto's signature piano work and classic Fennesz production ('Venice') 'Cendre' feels like the perfect meeting of minds. Sakamoto's haunting motifs are wrapped up in sheets of harmonic noise, but they never become overwhelming - rather this is an album which revolves around subtlety and attention to detail. There is one track 'trace' which is slightly unnerving dark ambience but no where near the fear enducing sounds of Rook Vallard. This album oozes Zen and calm. The sort of music you wish was playing during a massage, yet somehow never is. It is perfect baby music, this album has been sending my 11 month old daughter to sleep for some months now. A gorgeous album, and without a doubt one of the most beautiful records you'll hear.. .




news
Two Lone Swordsmen
MOVE over gnomes of Zurich. Irish leprechauns with pots of gold are ready to take your place on Europe's rich list. According to latest figures, the Irish are now as rich as the Swiss. Our wealth has soared from the lowest in the EU in 1973 to the second highest - judged, that is, by the measure of Gross Domestic Product (GDP) per person.
When it comes to music Lord Sabre Mr. Weatherall has "forgotten more, than most people know". Here working with Keith Tenniswood in their Two Lone Swordsmen guise. 'Emitions Audio Output - From The Archive volume 1. This is rather a splendid collection of Two Lone Swordsmen tracks cataloging their mid to late Ninties tracks before they abandoned their deep house leaning for straight up dancefloor electro.Culled mostly from the 'Swimming Not Skimming' and `Stockwell Steppas' ep's Their influence can't be underestimated and this has got some real gems on it. This comp is a neat bookend to their work up to the fantastic 'Tiny Reminders' album. From Dub and Ambient through to Techno and Electro with tracks llike 'Paisley Dark',Their homage to Prince's 'Paisley Park' label, 'Bim,Jack,and Florence', 'Rico's Helly' and 'Spraycan Attack' you get a real sense of how tidy Weatherall and Tenniswood's history has been. The Omid Nourizadeh AKA 16B remix of 'Rico's Helly' alone is worth the price of admission. Essential listening for fans or a great jump off point for the new listener. A worthy addition to any record collection..


cinema
The Lord of the Rings: The Two Towers
Dec 16th: We're all doomed: fear and loathing on the road to Mordor
Wftly dispel the magic.
What are the Ents going to look like? That's the anticipatory cringe for any Tolkien fan faced with a film version of The Two Towers. The corresponding question in The Fellowship of the Ring – how on earth will they tackle wacky old Tom Bombadil? – was dealt with by simple excision, but the Ents are too central to the story to omit. It's perfectly possible to read The Lord of the Rings believing in Treebeard without ever having visualised him (is he an anthropomorphic tree, or a dendromorphic man?). There are a controlled number of humorous situations in this mostly very grim film, but any whiff of whimsy or silliness, like a fart at High Mass, would swim







bigus is offline  
 :: quote post ::
Old 8th January 2010   #13
schlongfingers
software whore
 
Join Date: Oct 2002
Location: Blighted
Posts: 650
your last story node is malformed in a couple of ways:

...addition to any record collection..</bodytext>
</story>
MISSING <story>
<storytype>cinema</storytype>
<headline alignment="Joe Bloggs"> The Lord of the Rings: The Two Towers</headline>
<abstract>Dec 16th: We're all doomed: fear and loathing on the road to Mordor </abstract>
<bodytext>Wftly dispel the magic.SHOULD NOT BE HERE </bodytext>
What are the Ents going to look like? That's the anticipatory cringe for any Tolkien fan faced with a film version of The Two Towers. The corresponding question in The Fellowship of the Ring – how on earth will they tackle wacky old Tom Bombadil? – was dealt with by simple excision, but the Ents are too central to the story to omit. It's perfectly possible to read The Lord of the Rings believing in Treebeard without ever having visualised him (is he an anthropomorphic tree, or a dendromorphic man?). There are a controlled number of humorous situations in this mostly very grim film, but any whiff of whimsy or silliness, like a fart at High Mass, would swim</bodytext>
</story>
</sponsor_tab>



additionally any node that may contain ampersands, quotemarks and various other characters should be encloded in a CDATA block

like:

<abstract><![CDATA[Dec 16th: We're all doomed: fear and loathing on the road to Mordor]]></abstract>

Or it will fail - in your case I'd suggest all of your nodes should be CDATA enclosed, as any of them could potentially contain an ampersand in the future

I suspect the malformed xml is your sole issue here, as you mention it is reading up to a point then failing. if the php was errant it probably wouldn't read anything.
schlongfingers is offline  
 :: quote post ::
Old 8th January 2010   #14
bigus
Registered Erutufon Member
 
bigus's Avatar
 
Join Date: Jun 2005
Location: AMsterdam
Posts: 495
thanks schlongfingers
bigus is offline  
 :: quote post ::
Old 8th January 2010   #15
schlongfingers
software whore
 
Join Date: Oct 2002
Location: Blighted
Posts: 650
no probs. also it's not showing the bodytext cos you aren't echoing it out

echo $person_data[$thisPos]["abstract"];
echo $person_data[$thisPos]["bodytext"];
schlongfingers is offline  
 :: quote post ::
Reply


Thread Tools SEARCH THIS THREAD
SEARCH THIS THREAD:

Advanced Search
Display Modes

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 On
Forum Jump


All times are GMT +1. The time now is 21:44.


Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
all logos and site design (c) 2002-2009 station 55 productions S.L.