Easy PHP Calendar - We really take care of your dates!


Go Back   Easy PHP Calendar > General Discussion > General Support

General Support Questions about using the Easy PHP Calendar. (Not installation or customizations)

Closed Thread
 
Thread Tools Search this Thread Display Modes

Creating a XML File
Old 10-10-2006, 04:48 PM   #1
kennyweb
Calendar User
 
kennyweb is offline
Join Date: Oct 2006
Posts: 9
Default Creating a XML File

FYI - have created a script to export data base to XML file
Hope this can be helpful to someone else.


<?php
// example of connection to a database
$hostname ="remotemysqlhost";
$username ="kenn3_caldlma";
$password ="paswrd";
$dbName = "kenn3_dlmcal";

$conn = mysql_connect($hostname,$username,$password);
mysql_select_db($dbName) or die("Could Not Connect To Database");

// example of querying your table
$query = "select id, startDate, endDate, title, descr, category from epc_calendar";

// example of getting results from query
$result = mysql_query($query,$conn);
if($result) {
// if query ran successfully
// loop over results
//open file to write to
$file_handle = fopen('events.xml','w');

// i normal remove this this line
$xmlPacket = "<?xml version='1.0'?>\n";


//----
$xmlPacket .="<newsblock>\n";

while($row = mysql_fetch_array($result,MYSQL_ASSOC)){
// build xml to a variable
$xmlPacket .=
"\n<news>
<active>YES</active>
<id>".$row['id']."</id>
<startdate>".$row['startDate']."</startdate>
<enddate>".$row['endDate']."</enddate>
<title>".$row['title']."</title>
<descr>".$row['descr']."</descr>
<category>".$row['category']."</category>
</news> \n";
}
$xmlPacket .= '</newsblock>';
}
else{
// you probably want to remove this when you are putting this code live.
die('query failed' . mysql_error());

// you can replace it with this:
// which will just build an empty packet rather than killing the process
$xmlPacket = "<?xml version='1.0'?><calendar></calendar>";
}
// write var to file
fwrite($file_handle,$xmlPacket);
fclose($file_handle);
die('Done....');
?>
 

Old 10-10-2006, 05:57 PM   #2
Brian
EPC Developer
 
Brian's Avatar
 
Brian is offline
Join Date: Jun 2001
Location: Florida, USA
Posts: 10,878
Default

Thanks for sharing.

[Makes into a Sticky]
__________________
-- Brian

Questions?

Instructions: Version 6 - Version 7 | FAQ | Errors FAQ | Paths FAQ | Forums | Support
| Web Site Hosting
 

How can you turn this around to import?
Old 11-27-2006, 03:34 PM   #3
muskiediver
Calendar User
 
muskiediver is offline
Join Date: Aug 2006
Posts: 7
Default How can you turn this around to import?

We create a word document with calendar events, then manually put them one by one into our online calendar. How can you make our word document into an xml file to upload into PHP calendar?
 

Old 03-25-2008, 08:21 AM   #4
JerryDi
Calendar User
 
JerryDi is offline
Join Date: Apr 2007
Location: Cheshire, UK
Posts: 12
Default

I have used this script but get the following error:

XML Parsing Error: no element found
Location: http://www.??????.co.uk/members/calendar/events.xml
Line Number 5, Column 1:

any suggestions ?
rgds
jerry
 

Old 04-26-2008, 03:57 PM   #5
sobe_punk
Calendar User
 
sobe_punk is offline
Join Date: Apr 2008
Posts: 1
Default

Quote:
Originally Posted by JerryDi View Post
I have used this script but get the following error:

XML Parsing Error: no element found
Location: http://www.??????.co.uk/members/calendar/events.xml
Line Number 5, Column 1:

any suggestions ?
rgds
jerry
post your code and i will see if i can offer you any insight into your possible problem if you have yet to figure it out.

I have aquestion myself though... I have ZERO experience with .ics(iCal) filetypes and am looking for a method of querying the DB as it was successfully accomplished by the above script(thanks by the way) and parsing that info into a useable .ics file stored on my server which is the external feed to the (another) Calendar I also use. Anyone have any ideas?

Although it would be very nice, I'm not overly concerned with a 2-way sync, but instead just getting the feed to my (another) Calendar, in turn having it transmitted(auto synced which is already accomplished) to my BlackBerry.

Last edited by Brian; 04-26-2008 at 05:40 PM. Reason: missing info
 
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing Outlook file... teeohhem Customizations (Themes / Templates) 3 09-28-2006 09:30 PM
Corrupt File badhaircut Installation / Upgrade Questions 6 07-29-2006 08:22 AM
How to Handle Multiple Flat File Calendars (Version 5) jchilders General Support 2 05-23-2006 01:06 PM
No XML file in EasyPHP Calendar! can't install in Mambo aliweb Mambo/Joomla Integration 1 05-02-2006 11:41 AM
flat file newbie question mmcneal76 General Support 5 08-03-2004 01:17 PM



All times are GMT -4. The time now is 10:55 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright 2009 NashTech, Inc.

| Home | Register | Today's Posts | Search | New Posts |