Poll
Has Hilco abandoned this site?
Yes?
50%
No?
17%
I can't tell!
33%
Total votes: 6
- Login to post comments
- Older polls
User login
Recent comments
- php to update prices
1 year 4 weeks ago - I suggest you create a php
1 year 4 weeks ago - If you don't know much about
1 year 10 weeks ago - Hi Hilco
1 year 11 weeks ago - Hi Kha,
1 year 11 weeks ago - this should
1 year 16 weeks ago - Hi!
Well, there's not much
1 year 18 weeks ago - Have a look at the $_POST
1 year 19 weeks ago - Thanks Tony
1 year 19 weeks ago - 1) No, never use the same ID
1 year 20 weeks ago
New forum topics
Active forum topics
Who's new
XmL and XSLT
- Login to post comments
Sun, 06/29/2008 - 03:06
I guess its pretty obvious why exactly I need this. I have found spotted stuff on xml for tutorials on the web... none of which are very good. We even went to a bookstore - Borders and looked at all tech printed books - most of which are at least four years old or older.

instead of learning a new language, I would read the XML file with PHP and display it in the browser with HTML and apply CSS styles to it, like you do with a normal webpage.
Try to re-use a PHP class for XML that someone created and can be found on www.phpclasses.org, watch the introduction to classes video to get the idea on how to use classes.
the video can be found here:
http://www.strawberrycampus.com/node/56
we don't know what you mean by read the XML file with PHP.... please explain.....I did look at the video... and the website you mentioned. What exactly - well what class item description should I be looking for?
Also, I went into the Feed For All program in which I run several feeds through... I noticed this in the description field ... <1[CDATA[ .... then there is the usual html...like between lines and links are in here the usual way. When the description closes it closes with ..... ]]> CAN YOU EXPLAIN please?
To create an RSS feed, try this class:
http://www.phpclasses.org/browse/package/2957.html
This is the example code, can you see the structure? try to read and understand it
<?php
require_once 'rss_generator.inc.php';
$rss_channel = new rssGenerator_channel();
$rss_channel->atomLinkHref = '';
$rss_channel->title = 'My News';
$rss_channel->link = 'http://mysite.com/news.php';
$rss_channel->description = 'The latest news about web-development.';
$rss_channel->language = 'en-us';
$rss_channel->generator = 'PHP RSS Feed Generator';
$rss_channel->managingEditor = 'editor@mysite.com (Alex Jefferson)';
$rss_channel->webMaster = 'webmaster@mysite.com (Vagharshak Tozalakyan)';
$item = new rssGenerator_item();
$item->title = 'New website launched';
$item->description = 'Today I finaly launch a new website.';
$item->link = 'http://newsite.com';
$item->guid = 'http://newsite.com';
$item->pubDate = 'Tue, 07 Mar 2006 00:00:01 GMT';
$rss_channel->items[] = $item;
$item = new rssGenerator_item();
$item->title = 'Another website launched';
$item->description = 'Just another website launched.';
$item->link = 'http://anothersite.com';
$item->guid = 'http://anothersite.com';
$item->pubDate = 'Wed, 08 Mar 2006 00:00:01 GMT';
$rss_channel->items[] = $item;
$rss_feed = new rssGenerator_rss();
$rss_feed->encoding = 'UTF-8';
$rss_feed->version = '2.0';
header('Content-Type: text/xml');
echo $rss_feed->createFeed($rss_channel);
?>
It's important that you understand how classes save you a lot of time. Just include the file in your script, like how it's done at the top of the above script, and use the example to actually do something with it!
Another great class for you is the XML parser to read xml files. It will read the file and make an array out of it. With the array, you can do anything you like.
http://www.phpclasses.org/browse/file/17413.html
<?php
header('Content-type: text/plain');
include('lib.xml.php');
$xml = new Xml;
// Parse from a local file
$array = $xml->parse('myfile.xml', 'FILE');
echo '<pre>';
print_r($array);
echo '</pre>';
// Parse from a Web file
$array = $xml->parse('http://site.tld/myfile.xml', 'CURL');
echo '<pre>';
print_r($array);
echo '</pre>';
?>
A detailed explanation on how to use arrays can be found in this training video:
http://www.strawberrycampus.com/node/32
Hope that clarifies and that you see that by using a class, you are saving yourself a lot of time.
The steps to use a class successfully are:
1. Download the actuall class file(s)
2. Copy the example code that comes with it and work with that to alter the code to your needs
that's it!