Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > XML instead of SQL
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 16th June 00:45
yanal
External User
 
Posts: 1
Default XML instead of SQL


Hi,
I am relativly new to this world. I have read some about xml with php,
but I need some guidance!

I cannot use a database with my Unix account, but i want to be able to
create a dynamic website that will basically display articles. I *think*
that the way to do that is somewhere along this:

I will need something like this:

<article>
<date></date>
<author></author>
<title></title>
<body></body>
</article>

then with php i would be able to read in the "title" for example and
display it with the date in the index page.

My understanding is that I can do that in XML. and I would like to do
that with PHP.

my question(s) are:

1. how can I create the xml file? I could fill in a form with the
article infrmation and then upload it to some file on the server, but is
there a smart way to insert the xml tags other than doing something like
print ('<title>'+$article_title) to a file on a server?

2. when I have the "article" uploaded, should i have a seperate text
(xml) file for each article, or can i concatanate all in one file?

3. when I do have the xml file created, I am not exaclty sure how i can
get php (using built in function, or PEAR) to read in and parse the xml.
I can see all of those xml functions in php, but I am not sure exactly
what to do!

if you can think of some tutorial or do***entation please direct me.

thank you.
  Reply With Quote


  sponsored links


2 16th June 00:45
ian p. christian
External User
 
Posts: 1
Default XML instead of SQL


Look into the PHP DOM functions, very useful for this, and will do *exactly* what you need.

Put it all into one file, and use XSL to transform it (check
http://www.w3school.org for a quick tutorial on XSL (of which XSLT is a part of)).
XSL in PHP is easy, check http://php.net for functions.

See point 2


See point 1 and 2!
Good luck, and best wishes,

Ian P. Christian
  Reply With Quote
3 16th June 00:45
zurab davitiani
External User
 
Posts: 1
Default XML instead of SQL


You can use DOM extension like Ian suggested, or if you don't have DOM
extension available, or choose not to use it - take a look at ActiveLink
PHP XML Package:

http://www.active-link.com/intranet/software.php OR
http://sourceforge.net/projects/php-xml/
OR your favorite source.
This package is not dependent on any PHP XML extensions and comes with full
class do***entation, and an example/tutorial script to get you started.

See the included tutorial script.

It's up to you. You can use XSLT as Ian suggested. I would recommend not
keeping the file that you would parse most of the time (e.g. front page)
too big for performance reasons.

See the included tutorial script.


You are welcome.

--
Business Web Solutions
ActiveLink, LLC
http://www.active-link.com/intranet/
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666