PHP and XML problems - help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hairboy
Forum Newbie
Posts: 1
Joined: Mon Apr 13, 2009 7:05 am

PHP and XML problems - help

Post by hairboy »

Hi everyone. I'm a photographer, and I'm trying to design a website for myself, and I've been advised to use PHP and XML to load the files into my flash based site. So, I did a bag of research, and I've read a book and loads of tutorials, and I've got pretty close to completion. Now, I have an annoying problem, and hoping someone can help me.

I have created a folder called images, inside which I have many categories, and for ease, I've called them category1, category2, etc. Inside which I have thumbnails and the main photo files, named thumb1 and image1, so that codes can be repeated in the PHP files that call them in.

I have PHP files in another folder called gallery_xml, and called each one category1.php, category2.php, etc.

<images>
<image>
<title>Portrait1</title>
<img>images/category1/img1.jpg</img>
<thumb>gallery_xml/category1/thumb1.jpg</thumb>
<desc><![CDATA[some description]]>'</desc>
</image>
<image>
<title>Portrait2</title>
<img>images/category1/img2.jpg</img>
<thumb>gallery_xml/category1/thumb2.jpg</thumb>
<desc><![CDATA[some description]]>'</desc>
</image>

I have another PHP file called categories, inside which I have lines

<category>
<title>Portraiture</title>
<desc><![CDATA[Portraiture]]></desc>
<picture>images/ategories/portraiture.jpg</picture>
<xml>gallery_xml/category1.xml</xml>
</category>

I have many categories with each category containing 10 or so photos, and the description is called up in Flash dynamic text box.

When I go to open the gallery movie, the default movie calls up category1, and all the photos, titles, descriptions in this category come up fine. When I move tocategory2, 3, 4, images and titles load OK. The description initially loads fine on image1, but when I move to the image2, 3, 4 onwards, it reads the description from category1. When I go back to the image1 on category 2, it is reading description from category 1. It is as if when I first open category2 image 1, it still hasn't read the full script, and when I move onto the other images, it finds somethingit doesn't like, and it goes to the default cateogry (1). I have read the script, and there don't seem to be any syntax errors, and Dreamweaver doesn't pick up any, neither. So it must be some bad coding (as I said, I'm a rookie on any coding. I've done plenty of front end designs in the past, but this is my first attempt at PHP and XML site.

Any pointers on what may be causing this would be appreciated.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: PHP and XML problems - help

Post by requinix »

Have you checked whether the XML is correct? If it is then the bug is probably in your Flash code.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Re: PHP and XML problems - help

Post by n00b Saibot »

what are those apostrophes doing in the Description field?
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: PHP and XML problems - help

Post by php_east »

hairboy wrote: <xml>gallery_xml/category1.xml</xml>
i am not quite certain about this part. xml is a reserved word for xml declaration, using it in the middle of your 'xml' may confuse the xml parser. it certainly confused me.
Post Reply