XML into PHP Script?

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
JayGeePee
Forum Newbie
Posts: 6
Joined: Sun Jun 07, 2009 11:37 pm

XML into PHP Script?

Post by JayGeePee »

I have a php script. I want to put a xml file in it, but cant seem to do it. I purchased a flash menu bar for XML, I keep getting this error -
Cannot view XML input using XSL style sheet
also

The character '<' cannot be used in an attribute value.
<Menu menuName="Home" Url="index.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLab...

This is the xml flash menu file i'm trying to use:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<MenuItems BarColor="000000"  menuText1="FFFFFF" menuText2="000000">
<Menu menuName="Home" Url="index.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="Details" Url="details.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="FAQ" Url="faq.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="Sign Up" Url="signup.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Login" Url="memberlogin.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Contacts" Url="contact.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Testimonials" Url="testimonials.php?referid=<? echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
</MenuItems>
 
Im trying to put the XML file into this. Im trying to replace the old menu buttons(red):

Code: Select all

 
</script>
<?
include "config.php";
include "style.php";
?>
<html><head>
 
<link href="images/main.css" rel="stylesheet" type="text/css">
 
<link href="images/gb_styles.css" rel="stylesheet" type="text/css" media="all">
<style type="text/css">
<!--
body {
    margin-top: 0px;
    background-attachment: fixed;
    background-image: url(../images/back1.jpg);
    background-repeat: repeat;
    margin-bottom: 0px;
}
-->
</style></head><body background="images/back1.jpg" behavior="fixed">
 
 
<div id="site_wrapper" style="display: block;" align="center">
 
<table background="images/tableback.jpg" border="0" cellpadding="0" cellspacing="0" width="775">
    <tbody><tr>
      <td>
        <div align="center">
        <a href="http://www.domain.com"><img src="images/header.jpg" alt="domain.com" width="775" height="225" border="0" style="margin: 0pt; padding: 0pt;"></a>
        <table border="0" cellpadding="0" cellspacing="0" width="774">
            <tbody><tr>
              <td><table align="center" border="0" width="94%">
                <tbody><tr>
                  <td>
<table border="0" cellpadding="0" cellspacing="0" width="82%">
<tr>
    <td>
 
  </td></tr>
</table>
 <table width="80%" border="0" align="center">
  <tr >
    [color=#FF0000]<td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8 ><div align="center"><a href="index.php?referid=<? echo $referid; ?>">HOME</a></div></td>
    <td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="details.php?referid=<? echo $referid; ?>">DETAILS</a></div></td>
    <td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="faq.php?referid=<? echo $referid; ?>">FAQ</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="signup.php?referid=<? echo $referid; ?>">SIGNUP</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="memberlogin.php?referid=<? echo $referid; ?>">LOGIN</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="contact.php?referid=<? echo $referid; ?>">CONTACTS</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="testimonials.php?referid=<? echo $referid; ?>">TESTIMONIALS</a></div></td>[/color]  </tr>
</table>
 <div align="center"></div>          
I dont know if this is even possible. I bought the php script, and the XML file. I know a little bit about php, but not enough. I know nothing about using xml files, except editing them. I need some help on this one.

Thanks in advance.
Last edited by Benjamin on Mon Jun 08, 2009 12:04 am, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: XML into PHP Script?

Post by McInfo »

Does your XML file have a .xml or .php extension? If it has a .xml extension, it is likely not being parsed by the PHP engine.

Try using long open tags (<?php) for PHP code instead of short open tags (<?).

Code: Select all

<?php echo $referid; ?>
and

Code: Select all

<?php
include "config.php";
include "style.php";
?>
Also, this strikes me as odd. Usually, <html> and <head> come before <script> and <style>.

Code: Select all

</script>
<?
include "config.php";
include "style.php";
?>
<html><head>
Are you trying to embed the XML directly into the HTML? In other words, are you trying to replace <td>s with <Menu>s? You mentioned Flash, so there must be something else going on.

If you paid for this code, it seems like there should be some technical support from the author included.

Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 10:34 pm, edited 1 time in total.
JayGeePee
Forum Newbie
Posts: 6
Joined: Sun Jun 07, 2009 11:37 pm

Re: XML into PHP Script?

Post by JayGeePee »

The XML File does have a .xml extension. If the php code looks funny, it might be because I'm editing it in Dreamweaver, along with XML file. It all works, my website is live, I just dont like the menu buttons. I tried getting support from the author of the XML file, but he said PHP isn't his specialty. So let me get this right...

Replace This:

Code: Select all

<? echo $referid; ?>
With This:

Code: Select all

<?php echo $referid; ?>
So on and so forth. I'll give it a try! Thanks
JayGeePee
Forum Newbie
Posts: 6
Joined: Sun Jun 07, 2009 11:37 pm

Re: XML into PHP Script?

Post by JayGeePee »

Does this look right? This is the php w/the XML file in it

Code: Select all

<?php
include "config.php";
include "style.php";
?>
 
<html><head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title></title>
 
body {
    margin-top: 0px;
    background-attachment: fixed;
    background-image: url(../images/back1.jpg);
    background-repeat: repeat;
    margin-bottom: 0px;
}
-->
</style></head><body background="images/back1.jpg" behavior="fixed">
 
 
<div id="site_wrapper" style="display: block;" align="center">
 
<table background="images/tableback.jpg" border="0" cellpadding="0" cellspacing="0" width="775">
    <tbody><tr>
      <td>
        <div align="center">
        <a href="http://www.domain.com"><img src="images/header.jpg" alt="Domain.com" width="775" height="225" border="0" style="margin: 0pt; padding: 0pt;"></a>
        <table border="0" cellpadding="0" cellspacing="0" width="774">
            <tbody><tr>
              <td><table align="center" border="0" width="94%">
                <tbody><tr>
                  <td>
<table border="0" cellpadding="0" cellspacing="0" width="82%">
<tr>
    <td>
 
  </td></tr>
</table>
 <?xml version="1.0" encoding="iso-8859-1"?>
<MenuItems BarColor="000000"  menuText1="FFFFFF" menuText2="000000">
<Menu menuName="Home" Url="index.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="Details" Url="details.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="FAQ" Url="faq.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay=""/>
<Menu menuName="Sign Up" Url="signup.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Login" Url="memberlogin.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Contacts" Url="contact.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
<Menu menuName="Testimonials" Url="testimonials.php?referid=<?php echo $referid; ?>" window="_self" swf="" FrameLabelStop="" FrameLabelPlay="" />
</MenuItems>
 
Heres the untouched version of the php

Code: Select all

<?
include "config.php";
include "style.php";
?>
<html><head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title></title>
<link href="images/main.css" rel="stylesheet" type="text/css">
 
<link href="images/gb_styles.css" rel="stylesheet" type="text/css" media="all">
<style type="text/css">
<!--
body {
    margin-top: 0px;
    background-attachment: fixed;
    background-image: url(../images/back1.jpg);
    background-repeat: repeat;
    margin-bottom: 0px;
}
-->
</style></head><body background="images/back1.jpg" behavior="fixed">
 
 
<div id="site_wrapper" style="display: block;" align="center">
 
<table background="images/tableback.jpg" border="0" cellpadding="0" cellspacing="0" width="775">
    <tbody><tr>
      <td>
        <div align="center">
        <a href="http://www.Domain.com"><img src="images/header.jpg" alt="Domain.com" width="775" height="225" border="0" style="margin: 0pt; padding: 0pt;"></a>
        <table border="0" cellpadding="0" cellspacing="0" width="774">
            <tbody><tr>
              <td><table align="center" border="0" width="94%">
                <tbody><tr>
                  <td>
<table border="0" cellpadding="0" cellspacing="0" width="82%">
<tr>
    <td>
 
  </td></tr>
</table>
 <table width="80%" border="0" align="center">
  <tr >
    <td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8 ><div align="center"><a href="index.php?referid=<? echo $referid; ?>">HOME</a></div></td>
    <td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="details.php?referid=<? echo $referid; ?>">DETAILS</a></div></td>
    <td width="13%" class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="faq.php?referid=<? echo $referid; ?>">FAQ</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="signup.php?referid=<? echo $referid; ?>">SIGNUP</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="memberlogin.php?referid=<? echo $referid; ?>">LOGIN</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="contact.php?referid=<? echo $referid; ?>">CONTACTS</a></div></td>
    <td width="13%"  class=button onMouseOver="this.className='buttontwo'" onMouseOut="this.className='button'" tabIndex=8><div align="center"><a href="testimonials.php?referid=<? echo $referid; ?>">TESTIMONIALS</a></div></td>
  </tr>
</table>
 <div align="center"></div>          
I need some pionters, if you need more info or files let me know.
Thanks
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: XML into PHP Script?

Post by McInfo »

To me, it does not look right. <MenuItems> and <Menu> are not valid HTML tags.

I think the XML file is intended to be processed by a Flash script and the Flash is supposed to be embedded in the HTML/PHP document. Originally, how was the XML supposed to be connected to the HTML?

If you request help from the author without mentioning PHP, will you get some help?

Edit: This post was recovered from search engine cache.
Post Reply