How To Save Direct To XML File

Hello,

I was wondering if there is a way to save events straight to the XML file using the PHP scripting language, without the necessity of a database server, as mine is not working properly for some reason. I have found other ways to modify an XML file using PHP, but there is much scripting involved for me to implement it within the scheduler program, making things a bit complex. So I search for a less complicated method. Can someone help me out with this one :question:

P.S.
At the moment, everything is on localhost,
and database server (MySQL,MSSQL,(other))
is kind-of out of the question, temporarily, because
I broke them on a different project.

This is a quite common request so we will add serialize-to-xml extension for the scheduler, which will allow the above use-case.

This functionality still in progress, but I think that in few days I will be able to provide the demo.

Please update this part when you do, so I can find the link to the area where you have put the solution, and I would appreciate that very much. Thanx! If I had to do that coding myself, things would have probably been pretty tough for me, since I am not very experienced with php just yet. There are a lot of things to go through, to edit this thing, and I like it… but that would’ve been pretty tough, I think. Thank you again.

You can check the attached sample.
1269010497.zip (47.6 KB)

Thanx, I’ll check it out, and we’ll see what happens!


It works Great! Thank you so much.

I have a problem with save button.

It just work fine when you see the webpage for the first time.
When you create a new event or delete another one, save button is just a button with no action.

I need to be able to create ics file always. Any idea?

It works correctly locally ( adding and saving )
Be sure that for data loading you are using, code similar to the one in the sample

scheduler.load(“php/data.xml?uid=”+scheduler.uid());

uid part prevents data caching, which may be a reason of the problem in your case

I am loading events from database like this:

scheduler.load(“events.php?uid=”+scheduler.uid());

events.php does coneccion with data base and get all events from it.

I have the problem when I push save button after create or delete one or more events on calendar. Before create or delete, save button creates ics file but after that, it doesn’t work.

If I use example files with no modification, I get the same result. I am using xampp for uploading files

I don’t understand it. I downloaded your example again and it works perfectly. But, in the moment I use it on my webpage, it crashes.

I am using this scripts:

[code]



[/code]

And my init is this one:

[code]function init() {
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.first_hour = 8;
scheduler.config.last_hour = 23;
scheduler.init(‘scheduler_here’,new Date(2009,5,1),“month”);

	scheduler.config.details_on_create=true;
	scheduler.config.details_on_dblclick=true;
	scheduler.load("events.php?uid="+scheduler.uid());
	
	var dp = new dataProcessor("events.php");
	dp.init(scheduler);
	
}[/code]

Rest of things are same for both. Maybe it has some problem using recurrent events, is it possible? if there are any problem like this… has easy solution?

I haven’t said before but thanks for all time you are expending in helping me

Ok, I have trying things and I discovered what fails. In the moment I use this script:

<script src="codebase/ext/dhtmlxscheduler_recurring.js" type="text/javascript" charset="utf-8"></script>

Serialize fails when you create or erase an event. If recurring script is erased, serialize works fine.

Any solution??

I have tryied to put serialize script before and after recurrent script but it doens’t matter… Same result always

Attached sample contains the updated code, which will work with recurring events.
recurring.ZIP (49.5 KB)

Thank you so much. It works now perfectly.

Hi!

I am trying now to export to ics file. I saw there a function already done to do that. But each time I change code to use that function instead xml function, it doens’t work.

What I have to change?

I change:

form.elements.data.value = scheduler.toXML(); in web page
in php for saving, I choose ics extension and no more changes.

I tried to change:
var form = document.getElementById(“xml_form”);

for
var form = document.getElementById(“ics_form”);

but no result were got.

Any more changes??

You need to change

toXML => toICal
load(…) => load(…, “ical”);

By the way - It will not support recurring events

Hello.
I have tried to use recurring.ZIP but I have a problem with loading XML file.

My browser is “google chrome”.
I change my schedule and close tab.
At that time my data seems to saved. (I checked file size.)
Then I try to restore the closed tab.
An alert box appears and say “Error type: LoadXML Description: Incorect XML”.
My “data.xml” file size became 0 byte.

Any idea to fix this?

I’m sorry to my poor English.

Are you using exactly the same code of php file or with some modifications?
Locally the sample works correctly ( was checked in Chrome )
You can try to create a “dummy.html” file in the same folder as “xml_writer.php” ( content of file doesn’t matter )

Thank you for your response.
I use exactly the same php file with dummy.html file (empty file)
The sample works correctly in IE 6,7 / Firefox 3.6.
Uneasiness remains because I don’t know why it is crashed in chrome sometimes.
Anyway, I try to use it for a while.
Thank you.

One more suggestion , try to place some content inside dummy.html ( at least 1 kb of data)
dummy.html is used to prevent double call of data saving script, and Chrome can ignore html file with zero or less than 1kb size.

Hi,

I have tried with scheduler.toXml() to save the current event which is created newly. i couldn’t make it successfully. Please any one help me.

Thanks in advance.

BoseLenin