Search found 9 matches

by ubergrafik
Tue Oct 16, 2007 6:24 pm
Forum: PHP - Code
Topic: Accessing arrays with : in their names. How?
Replies: 8
Views: 671

Has any one got any ideas? I'm really stumped...

:B
by ubergrafik
Mon Oct 15, 2007 12:34 am
Forum: PHP - Code
Topic: Accessing arrays with : in their names. How?
Replies: 8
Views: 671

I've been playing around with this again and still no joy. I have changed my code to the following: <?php $file = $_FILES['userfile']['tmp_name']; $xml_str = file_get_contents ($file); echo 'xml_str: <br><br>'.$xml_str; //============================================== //ITEMS //=====================...
by ubergrafik
Mon Aug 20, 2007 12:53 am
Forum: PHP - Code
Topic: Accessing arrays with : in their names. How?
Replies: 8
Views: 671

It's not accessing the elements that's the problem, it's the way they are named. I have googled and found nothing like this. I have tried: echo $doc->imsmd.':'.lom->CDATA(); echo $doc->imsmd/lom->CDATA(); echo $doc->imsmd./.lom->CDATA(); Each time I get the same error: Parse error: parse error, expe...
by ubergrafik
Mon Aug 20, 2007 12:37 am
Forum: PHP - Code
Topic: Fatal error: Call to a member function on a non-object...
Replies: 5
Views: 454

Ahhh!! I forgot to reset my $itemCount variable at the end of the second for loop, immediately after the echo '</p>'; line. Works perfect now! Thanks all.
by ubergrafik
Sun Aug 19, 2007 9:17 pm
Forum: PHP - Code
Topic: Fatal error: Call to a member function on a non-object...
Replies: 5
Views: 454

Ok, here is the full code. Because I am running php4, I am using the XML classes found at: http://www.ister.org/code/simplexml44/index.html <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <?php require_once('includes/c...
by ubergrafik
Sun Aug 19, 2007 9:08 pm
Forum: PHP - Code
Topic: Fatal error: Call to a member function on a non-object...
Replies: 5
Views: 454

Yes, I am instantiating the XML loader object as $doc, in an earlier area. It runs the code correctly until the llop finishes, then the error is echoed. That's the puzzling part, it all works until the last moment...
by ubergrafik
Sun Aug 19, 2007 8:51 pm
Forum: PHP - Code
Topic: Accessing arrays with : in their names. How?
Replies: 8
Views: 671

Thanks for the replys. I should have mentioned that I am using php4...

arborint, when i do this, I see a blank page.

volka, unfortunately I am using php4.
by ubergrafik
Sun Aug 19, 2007 8:49 pm
Forum: PHP - Code
Topic: Fatal error: Call to a member function on a non-object...
Replies: 5
Views: 454

Fatal error: Call to a member function on a non-object...

I have a piece of php code that looks like this: for($j = 0; $j < $itemCount; $j++){ $item = $doc->menu->section[$i]->item[$j]->attributes(); $itemText = $item['text']; $itemHref = $item['href']; $itemTarget = $item['target']; echo '<a target='.$itemTarget.' href='.$itemHref.'>'.$itemText.'</a></br>...
by ubergrafik
Wed Aug 15, 2007 1:14 am
Forum: PHP - Code
Topic: Accessing arrays with : in their names. How?
Replies: 8
Views: 671

Accessing arrays with : in their names. How?

I have an XML file that contains an element name as follows: <imsmd:langstring>Data in here.</imsmd:langstring> I am using PHP to extract specific elements from the XML file and display them. I am trying the following: echo $doc->imsmd:lom->CDATA(); The parser chokes on the : between imsmd and lom, ...