XML

Here non-phpBB topics can be discussed.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

XML

Postby Morris » 02 Apr 2007, 21:11

I have an adres to a XML source, how do i make it so i can display this XML on my page?

Is there any easy way to do this?

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby igorw » 02 Apr 2007, 22:22

XML alone is just pure data. You need to do something with the data. For example MODX uses XML to store the MOD actions. It then uses an xsl stylesheet to style that data (wich will result in a html-simillar page). RSS feeds use the data in other ways, there are differen't clients that display and manage that data differently.

Hope that gives you a better understanding of what XML is.

So the answer to your question... yes, it's possible to display XML on your page. If you have PHP5, it's very easy to convert XML to an array (with simpleXML), and then display it whatever way you like :D

- we're poor!

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 02 Apr 2007, 22:30

Ok so how do i make all this then?
Is there any simple way to do this for an amatuer?

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby igorw » 02 Apr 2007, 23:11

You need to give us more information...

Are you on PHP5? What's the link to that XML file?

- we're poor!

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 02 Apr 2007, 23:21

Yes i have PHP5, and the link is, http://www.svenskaspel.se/includes/xmle ... roduktid=1

Thats just one, and i have alot more with different contents, but lets try with this one above.

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby igorw » 03 Apr 2007, 00:50

Have a look in the manual: [man]simplexml[/man]

- we're poor!

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 03 Apr 2007, 09:50

Unfortunately that manual thosent say so mutch to me. :\

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby igorw » 03 Apr 2007, 15:57


- we're poor!

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 03 Apr 2007, 17:19

So is that all i need to do then?
Just put that in where it should be?

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby igorw » 03 Apr 2007, 17:24

well just paste that into an empty file (with <?php ?> tags), and see what you get ;)

- we're poor!

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 03 Apr 2007, 17:32


User avatar
Noobarmy
Past Contributor
Past Contributor
Posts: 545
Joined: 02 Jun 2006, 11:19
Real name: Anthony Chu
Location: UK
Contact:

Postby Noobarmy » 03 Apr 2007, 17:36

[php]
<?php
$contents = file_get_contents('http://www.svenskaspel.se/includes/xmlelements/XMLkupong.asp?produktid=1');

$xml = new SimpleXMLElement($contents);

echo '<pre>' . print_r($xml, true) . '</pre>';
?>
[/php]

Morris
Member
Member
Posts: 50
Joined: 15 Nov 2006, 13:10
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Postby Morris » 03 Apr 2007, 19:02

Thank.

How do i go from here do make the disply look a little bit nicer?


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 9 guests