Hello all,
Im a bit new to php and new to phpfreaks. But thanks in advance for the help!
Im parsing an xml feed into a table. The only problem is that one of the fields can not format properly in the table.
Here is how the page is working now: http://russiancirclesband.com/tour.php
The "With" column is spacing out $OtherArtists out one entry per line, whereas it should have however many $OtherArtists were listed on that line per date.
Here is the PHP
Code:
<?php
$xml_file = "XML FEED";
$xml_City_key = "*SHOWS*SHOW*CITY";
$xml_VenueName_key = "*SHOWS*SHOW*VENUENAME";
$xml_VenueZip_key = "*SHOWS*SHOW*VENUEZIP";
$xml_VenueAddress_key = "*SHOWS*SHOW*VENUEADDRESS";
$xml_TicketUri_key = "*SHOWS*SHOW*TICKETURI";
$xml_Description_key = "*SHOWS*SHOW*DESCRIPTION";
$xml_VenueUri_key = "*SHOWS*SHOW*VENUEURI";
$xml_Date_key = "*SHOWS*SHOW*DATE";
$xml_TimeSet_key= "*SHOWS*SHOW*TIMESET";
$xml_State_key = "*SHOWS*SHOW*STATE";
$xml_Country_key = "*SHOWS*SHOW*COUNTRY";
$xml_OtherArtists_key = "*SHOWS*SHOW*OTHERARTISTS*NAME";
$Show_array = array();
$counter = 0;
class xml_Show{
var $City, $VenueName, $VenueZip, $VenueAddress, $TicketUri, $Description, $VenueUri, $Date, $TimeSet, $State, $Country, $OtherArtists ;
}
function startTag($parser, $data){
global $current_tag;
$current_tag .= "*$data";
}
function endTag($parser, $data){
global $current_tag;
$tag_key = strrpos($current_tag, '*');
$current_tag = substr($current_tag, 0, $tag_key);
}
function contents($parser, $data){
global $current_tag, $xml_City_key, $xml_VenueName_key, $xml_VenueZip_key, $xml_VenueAddress_key, $xml_TicketUri_key, $xml_Description_key, $xml_VenueUri_key, $xml_Date_key,$xml_TimeSet_key, $xml_State_key, $xml_Country_key, $xml_OtherArtists_key, $counter, $Show_array;
switch($current_tag){
case $xml_City_key:
$Show_array[$counter] = new xml_Show();
$Show_array[$counter]->City = $data;
break;
case $xml_VenueName_key:
$Show_array[$counter]->VenueName = $data;
break;
case $xml_VenueZip_key:
$Show_array[$counter]->VenueZip = $data;
break;
case $xml_VenueAddress_key:
$Show_array[$counter]->VenueAddress = $data;
break;
case $xml_TicketUri_key:
$Show_array[$counter]->TicketUri = $data;
break;
case $xml_Description_key:
$Show_array[$counter]->Description = $data;
break;
case $xml_VenueUri_key:
$Show_array[$counter]->VenueUri = $data;
break;
case $xml_Date_key:
$Show_array[$counter]->Date = $data;
break;
case $xml_TimeSet_key:
$Show_array[$counter]->TimeSet = $data;
break;
case $xml_State_key:
$Show_array[$counter]->State = $data;
break;
case $xml_Country_key:
$Show_array[$counter]->Country = $data;
break;
case $xml_OtherArtists_key:
$Show_array[$counter]->OtherArtists = $data;
$counter++;
break;
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$data = file_get_contents($xml_file);
if(!(xml_parse($xml_parser, $data))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
?>
<html>
<head>
<title>Russian Circles - Tour</title>
<style type="text/css">
<!--
#blog {
padding: 15px 15px 15px 60px;
top: 400px;
}
body {
background-image: url(tiledis.gif);
background-repeat: repeat-x;
background-color:#000000;
}
a:link {
color: #FFFFFF;
text-decoration:underline;
}
a:visited {
color: #FFFFFF;
text-decoration:underline;
}
.style1 {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 12px;
color: #ffffff;
}
.style2 {
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-size: 12px;
color: #4e4e4e;
}
#whole {
position:absolute;
width:850px;
z-index:1;
top: 0px;
margin-left:auto;
margin-right:auto;
background-color:#ffffff;
}
body,td,th {
color: #FFF;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></head>
<body>
<table width="850" align="center" border="1">
<tr>
<td width="100"><div align="center">
<span class="style2">
<u>Date</u>
</span></div>
</td>
<td width="300"><div align="center">
<span class="style1">
<u>Location</u>
</span>
</td></div>
<td width=250"><div align="center">
<span class="style1">
<u>Venue</u>
</span>
</td>
<td width="350"><div align="center">
<span class="style1">
<u>With</u>
</div>
</span>
</td>
<td width="250"><div align="center">
<span class="style1">
<u>Tickets</u>
</div>
</span>
</td>
</tr>
<span class="style1"><div align="center">
<?php
for($x=0;$x<count($Show_array);$x++){
echo "<tr>";
echo "<td>";
echo "t" . $Show_array[$x]->Date . "n";
echo "</td>";
echo "<td>";
if ($Show_array[$x]->Country == "United States") {
echo "t" . $Show_array[$x]->City . ","; echo "t" . $Show_array[$x]->State . " n";
} else {
echo "t" . $Show_array[$x]->City . ","; echo "t" . $Show_array[$x]->Country . " n";
}
echo "</td>";
echo "<td>";
echo "t" . $Show_array[$x]->VenueName . "n";
echo "</td>";
echo "<td>";
echo "t" . $Show_array[$x]->OtherArtists . "";
echo "</td>";
echo "<td>";
if ($Show_array[$x]->TicketUri == "") {
echo "
";
} else {
echo "<a href='" . $Show_array[$x]->TicketUri . "'>Buy Tickets</a>";
}
echo "</td>";
echo "</tr>";
}
?>
</table>
</p>
</div>
<table width="665" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5"><div align="center"><a href="http://russiancirclesband.com"><img src="img/rcgeneva.png" width="300" height="38" border="0" /></a><a href="http://russiancirclesband.com"><img src="img/csoct202009.png" width="300" height="38" border="0" /></a></div></td>
</tr>
<tr>
<td colspan="5"><div align="center"></div></td>
</tr>
<tr>
<td width="133"><div align="center"><a href="http://www.myspace.com/russiancircles" target="_blank"><img src="img/rcspace.png" width="133" height="25" border="0" /></a></div></td>
<td width="133"><div align="center"><a href="http://russiancircles.hellomerch.com" target="_blank"><img src="img/rcstore.png" width="133" height="25" border="0" /></a></div></td>
<td width="133"><div align="center"><a href="http://russiancirclesband.blogspot.com/" target="_blank"><img src="img/rcnews.png" width="133" height="25" border="0" /></a></div></td>
<td width="133"><div align="center"><a href="contact.html" target="_self"><img src="img/rccontacts.png" width="133" height="25" border="0" /></a></div></td>
<td width="133"><div align="center"><a href="http://www.myspace.com/russiancircles" target="_blank"><img src="img/rctour.png" width="133" height="25" border="0" /></a></div></td>
</div>
</tr>
</table>
</body>
</html>
and here is a sample of the xml:
Code: <shows xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://feeds.artistdata.com/_css/shows.xsd">
<show>
<recordKey></recordKey>
<name><![CDATA[]]></name>
<city><![CDATA[Brooklyn]]></city>
<venueName><![CDATA[Knitting Factory]]></venueName>
<venueZip></venueZip>
<venuePhone>(347)529-6696</venuePhone>
<venueAddress><![CDATA[361 Metropolitan Ave]]></venueAddress>
<ticketURI><![CDATA[]]></ticketURI>
<description><![CDATA[]]></description>
<ageLimit>All Ages</ageLimit>
<venueURI><![CDATA[http://ny.knittingfactory.com/index.php]]></venueURI>
<ticketPrice><![CDATA[ADV $10 DOOR $12]]></ticketPrice>
<date>2009-12-03</date>
<timeSet>20:30:00</timeSet>
<timeDoors></timeDoors>
<stateAbbreviation>NY</stateAbbreviation>
<state>New York</state>
<countryAbbreviation>US</countryAbbreviation>
<country>United States</country>
<otherArtists>
<name><![CDATA[Cast Spells]]></name>
<uri><![CDATA[http://myspace.com/castspells]]></uri>
</otherArtists>
<artistname>Good Old War</artistname>
<artistKey></artistKey>
</show>
</shows>
So obviously the wall Other Artists are being called is slightly different, but im not exactly sure what is happening. to see what JUST $OtherArtists echo'ing would look like, check out: http://russiancirclesband.com/tour2.php.
Not sure what my next move is.
Thanks again!
Handling text changed in text box control using Ajax
I need to create a web form with a text box control. When someone types text into the textbox I need to post back to a C# or VB method to handle the changed text entered into the text box control.Is
How to secure my login data to my database?
Hi there,It may be a stupid question but I don't know how to secure my login data to my database. I have created an include file in order not to have these data in the code of my pages, but I don't
if else problem, help please
i have this script that i made only i try to also put in a if else for for some reason the script is not putting out the else echo. its not really a problem as the script works but it would be nice to
SWF image using php?
Hello once again.My latest en devour requires me to produce an image of a static .swf that is embedded on a page.Unfortunately, it has a selection of variables passed to it.EgCode: <object
Date Format
Hi there,I have a date format like this right now:Sat, 17 Oct 2009 17:04:00 I need to turn that into:2009-10-17T17:04:00ZMy thought process was to remove with regex "Sat," and then just
Comment Mod System Effects all rows...
Sorry if its confusing but here is whats going on: I have a table in a database called comments and there are alot of entries there but can manually be marked flagged with a 1. nevermind how that is
GIS appliction help
I found some tutorials in the internet to develop a map application I don't want to use google maps I have my own images so I wanna zoom in those images and able 2 move through images what I found
Newb advice
Hi all,I'm a flash front end designer and I've taken on a project that needs some back end php.It's not completely greek to me as I write actionscript in flash which is an OO language.However... I
Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website membership from on their computer. He's afraid that the users might share their login's with their
Load file in PHP
I have 2 files. The first is a PHP generated XML file that's dependent by 2 inputs. The second is a PHP file that grabs the content of the XML file.So I have