Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Xml Feed Generated By Php

Featured Replies

Hi Guys

 

I am having trouble feeding the Week Planner (from dhtmlgoodies) my generated xml feed. The package comes with a php xml generator which the main script reads and works with. If I try and feed it a simple, static xml (which I think is emulating the xml structure correctly) the script shows no data at all?? I am trying to get that far before generating my own xml feed from my own dynamic source!

 

My data is here

 

The data generated by php here but when I browse the file directly I get an XML error and I can't see the resultant xml structure.

 

Any help would be great!

 

The php code generating the xml is below:

 

www<?
echo '<?xml version="1.0" ?>';

/* Input to this file:

$_GET['year'];
$_GET['month'];
$_GET['day'];

*/

$startOfWeek = date("Y-m-d H:i:s",mktime(0,0,0,$_GET['month'],$_GET['day'],$_GET['year']));
$endOfWeek = strtotime($startOfWeek."+1 WEEK");

// You will typically make a db query like this:
/*
$res = mysql_query("select * from weekSchedule where eventStartDate>='$startOfWeek' and eventEndDate<'$endOfWeek'");
while($inf = mysql_fetch_array($res)){
?>
<item>
	<id><? echo $inf["ID"]; ?></id>
	<description><? echo $inf["description"]; ?></description>
	<eventStartDate><? echo gmdate('D, d M Y H:i:s',strtotime($inf["eventStartDate"])) . ' GMT'; ?></eventStartDate>
	<eventEndDate><? echo gmdate('D, d M Y H:i:s',strtotime($inf["eventEndDate"])) . ' GMT'; ?></eventEndDate>
	<bgColorCode><? echo $inf["bgColorCode"]; ?></bgColorCode>
</item>
<?

}

*/


/********************************************************************************
*****
*
* The code below is just an example used for the demo
*
********************************************************************************
******/

$week1 = date("2006-02-13 00:00:00");
$week2 = date("2006-02-20 00:00:00");
$week3 = date("2006-02-27 00:00:00");
$week4 = date("2006-03-06 00:00:00");
$week5 = date("2006-03-13 00:00:00");

if($startOfWeek>=$week1 && $startOfWeek<$week2){
?>

<item>
<id>1</id>
<description>Lunch</description>
<eventStartDate>Mon, 13 Feb 2006 11:30 GMT</eventStartDate>
<eventEndDate>Mon, 13 Feb 2006 12:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<item>
<id>2</id>
<description>Working with my project which is quite exciting.</description>
<eventStartDate>Mon, 13 Feb 2006 12:00 GMT</eventStartDate>
<eventEndDate>Mon, 13 Feb 2006 14:30 GMT</eventEndDate>
<bgColorCode>#FFFF00</bgColorCode>
</item>
<item>
<id>3</id>
<description>Meeting with clients</description>
<eventStartDate>Tue, 14 Feb 2006 13:00 GMT</eventStartDate>
<eventEndDate>Tue, 14 Feb 2006 15:00 GMT</eventEndDate>
<bgColorCode>#FFFF00</bgColorCode>
</item>
<item>
<id>4</id>
<description>Create requirement specification for the new project</description>
<eventStartDate>Wed, 15 Feb 2006 07:00 GMT</eventStartDate>
<eventEndDate>Wed, 15 Feb 2006 10:00 GMT</eventEndDate>
<bgColorCode>#EEEEEE</bgColorCode>
</item>
<item>
<id>6</id>
<description>Reading an exiting book</description>
<eventStartDate>Thu, 16 Feb 2006 18:00 GMT</eventStartDate>
<eventEndDate>Thu, 16 Feb 2006 20:00 GMT</eventEndDate>
<bgColorCode>#EEEEEE</bgColorCode>
</item>
<item>
<id>7</id>
<description>Playing chess</description>
<eventStartDate>Sat, 18 Feb 2006 12:00 GMT</eventStartDate>
<eventEndDate>Sat, 18 Feb 2006 13:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<item>
<id>8</id>
<description>Watch TV and do nothing</description>
<eventStartDate>Sun, 19 Feb 2006 17:00 GMT</eventStartDate>
<eventEndDate>Sun, 19 Feb 2006 19:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<item>
<id>9</id>
<description>Ouch!!! Dentist appointment</description>
<eventStartDate>Fri, 17 Feb 2006 09:00 GMT</eventStartDate>
<eventEndDate>Fri, 17 Feb 2006 10:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<?


}



if($startOfWeek>=$week2 && $startOfWeek<$week3){
?>

<item>
<id>11</id>
<description>Lunch</description>
<eventStartDate>Mon, 20 Feb 2006 11:30 GMT</eventStartDate>
<eventEndDate>Mon, 20 Feb 2006 12:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<item>
<id>12</id>
<description>Working with my project which is quite exciting.</description>
<eventStartDate>Mon, 20 Feb 2006 12:00 GMT</eventStartDate>
<eventEndDate>Mon, 20 Feb 2006 14:30 GMT</eventEndDate>
<bgColorCode>#FFFF00</bgColorCode>
</item>
<item>
<id>13</id>
<description>Meeting with clients</description>
<eventStartDate>Tue, 21 Feb 2006 13:00 GMT</eventStartDate>
<eventEndDate>Tue, 21 Feb 2006 15:00 GMT</eventEndDate>
<bgColorCode>#FFFF00</bgColorCode>
</item>
<item>
<id>14</id>
<description>Create requirement specification for the new project</description>
<eventStartDate>Wed, 22 Feb 2006 07:00 GMT</eventStartDate>
<eventEndDate>Wed, 22 Feb 2006 10:00 GMT</eventEndDate>
<bgColorCode>#EEEEEE</bgColorCode>
</item>
<item>
<id>16</id>
<description>Reading an exiting book</description>
<eventStartDate>Thu, 23 Feb 2006 17:00 GMT</eventStartDate>
<eventEndDate>Thu, 23 Feb 2006 19:30 GMT</eventEndDate>
<bgColorCode>#EEEEEE</bgColorCode>
</item>
<item>
<id>17</id>
<description>Dinner appointment</description>
<eventStartDate>Sat, 25 Feb 2006 17:00 GMT</eventStartDate>
<eventEndDate>Sat, 25 Feb 2006 19:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<item>
<id>18</id>
<description>Playing board games</description>
<eventStartDate>Sun, 26 Feb 2006 14:00 GMT</eventStartDate>
<eventEndDate>Sun, 26 Feb 2006 16:30 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<?
}


if($startOfWeek>=$week4 && $startOfWeek<$week5){
?>

<item>
<id>11</id>
<description>Lunch with some of my friends from school</description>
<eventStartDate>Mon, 06 Mar 2006 09:30 GMT</eventStartDate>
<eventEndDate>Mon, 06 Mar 2006 11:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<?
}
if($startOfWeek>=$week3 && $startOfWeek<$week4){
?>

<item>
<id>11</id>
<description>Taking some time off to just do fun stuff.</description>
<eventStartDate>Tue, 28 Feb 2006 11:30 GMT</eventStartDate>
<eventEndDate>Tue, 28 Feb 2006 15:00 GMT</eventEndDate>
<bgColorCode>#FFFFFF</bgColorCode>
</item>
<?
}

?>



 

I am not very conversant with PHP unfortunately and would also like to know where the $_GET statement is expecting to receive the parameters from. Would this be the session or the URL?

 

Thanks in advance

Just to quickly answer your question,

 

GET takes parameters out of your URL.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.