how to integrate PHP and mySql in Quark 8

Discuss Interactive Design & Flash® (SWF) Export inside QuarkXPress 7, 8 & 9.
Exchange ideas, share helpful tips and get started with your first interactive design.
Please note that Flash (SWF) authoring is not supported in QuarkXPress 10 anymore.
dutch_dave
Posts: 8
Joined: 19 Jan 2010, 06:15

how to integrate PHP and mySql in Quark 8

Post by dutch_dave » 04 Mar 2010, 01:24

Hi,
Can I have PHP scripts integrate in Quark to 'talk' with mySql databases on our server? We build webtraffic campaigns in Flash now. First design, than rebuild it in Flash, than integrate PHP scripts to upload respons from mySql database or prefill fields with customer details from a mySql database. I want to skip Flash. So now we've built a website for our customer in Quark Interactive, but our PHP programmer tells me he cannot program when he opens the .swf file in Flash. Thus the only option is to PHP in Quark...

Hope to hear from you soon..

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

how to integrate PHP and mySql in Quark 8

Post by Matthias Guenther (Quark) » 04 Mar 2010, 01:57

Hi Dave,
you can communicate using URLs or by posting via POST/GET, so yes.
See the thread just a few days ago how to trigger a Server Script for sending email.
Thanks
Matthias

dutch_dave
Posts: 8
Joined: 19 Jan 2010, 06:15

how to integrate PHP and mySql in Quark 8

Post by dutch_dave » 04 Mar 2010, 03:44

Hi Matthias,
Than I should find myself a PHP programmer who has Quark 8. Any ideas? :-)
Regards,
David

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

how to integrate PHP and mySql in Quark 8

Post by Matthias Guenther (Quark) » 04 Mar 2010, 04:03

Hi Dave,
wait, I hope we are talking about the same thing:
You want to create a SWF that upon runtime interacts with some server logic/script (using PHP). The PHP script wouldn't run "inside" QuarkXPress or the SWF, it reacts to data being sent from the SWF via get/post and sends back plain text or changes picture URLs that are loaded in the SWF.
Is that your understanding too?

Thanks
Matthias

dutch_dave
Posts: 8
Joined: 19 Jan 2010, 06:15

how to integrate PHP and mySql in Quark 8

Post by dutch_dave » 04 Mar 2010, 04:15

Please look at this URL: http://www.win750euro.nl/matthias (login code: 99999)
This what we call webtraffic campaign: a customer receives a postcard with personal URL and login code.
Does it make it clear what we want to achieve? These pages are personal (Dear Mr. Matthias, customers details etc., validations scripts etc.). So I think we should program in Quark. Don't you think?

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

how to integrate PHP and mySql in Quark 8

Post by Matthias Guenther (Quark) » 04 Mar 2010, 19:15

Ok, I tried it and won 750 EUR, looking forward to it ;-)
I think I understand now, so what you need is a generic SWF that allows entering a passcode, sends that to a server, the passcode is associated with an address and then the SWF becomes personalized, it shows the associated personal data.
I am positive that this is possible, as SWFs out of QuarkXPress can send data to a server and receive data back. As this is done via GET/POST URLs you need to remember that the data transmission is not secure.
However it woudl be interesting to test this and see whether it really works. If you want, I can help you with the client side (so in QuarkXPress 8).
And you wouldn't need a programmer who knows QuarkXPress, as all you'd do is pass URLs aroudn and read from URLs.
Thanks
Matthias

dutch_dave
Posts: 8
Joined: 19 Jan 2010, 06:15

how to integrate PHP and mySql in Quark 8

Post by dutch_dave » 04 Mar 2010, 21:12

You lucky man! 750 euro in new menswear. Good on 'ya! You must cash in Holland though... ;-). Seriously. As you see the website you saw has been made in HTML. I have a little knowledge about Dreamweaver, so I can see that the actual PHP scripting has been done with .php files like start2.php. This file checks the name at the end of the personal URL and number and routes the customer to a different page when the URL of login code is wrong.
So I have the feeling with POST and GET it must work. Enclosed the lines in the login page:




If you can tell me how I can activate this start2.php file in Xpress (I know how to make objects, events and scripts). I will make an object that is called 'login' and a textfield 'login_number' (no experience though with fields, but that must not be that hard). I can check if this works. It's the most important part of the session. If this works, I'm sure the rest of the pages (most of it, get data from mysql en post the respons back into mysql).
Regards,
David

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

how to integrate PHP and mySql in Quark 8

Post by Matthias Guenther (Quark) » 04 Mar 2010, 21:30

Hoi David,
Duitsland is niet te ver weg van Nederlands :-)
For a simple test, create a layout with two text boxes. Make both of them Textbox objects (in Object tab), type Editable, and give them the exact names you specified above.
Now create a button (or aynthing else that triggers the script) and upon Event "click up" execute the action "Text > Post to URL", "All editable Objects", method POST.
For the URL you need to enter the URL of your PHP script, so select external reference and in the path field enter the URL.
That should work.
Just, if your script redirects, you need to load a new Flash file then. How do you plan to do that?
Regards
Matthias

dutch_dave
Posts: 8
Joined: 19 Jan 2010, 06:15

how to integrate PHP and mySql in Quark 8

Post by dutch_dave » 04 Mar 2010, 22:33

Hallo Matthias,
also Deutsch... dann wird es also einfach sein um dein Voucher ein zu wecheln. :-)
We have build the new website for Van der Kam in Xpress. So enclosed you find the first page. We will try to build in your tips in this page today. And yes, it redirects indeed. Start2.php will active retour_server.php.Image Keep u informed!
Regards,

Matthias Guenther (Quark)
Quarkian
Quarkian
Posts: 2490
Joined: 04 Jun 2004, 15:06
Contact:

how to integrate PHP and mySql in Quark 8

Post by Matthias Guenther (Quark) » 17 Mar 2010, 01:55

Hi Dave,
as I just created a form and PHP script for our Flash8Magic page, for everybody who's interested here's how I did it:
1. Create a page with text boxes and a submit button. (My example uses five text boxes.)
2. Make all text boxes editable text boxes in Interactive palette (object tab). Write down the names of the boxes.
3. For the button create an event "click up" that triggers an action "Internet > Submit Page", method POST, to the URL of my PHP script (e.g. "http://www.yourdomain.com/mailscript.php").
The sendmail PHP script looks like this, note that the red names are matching the names of the box names in QuarkXPress 8:
name"];
$surname = $_POST["surname"];
$email = $_POST["email"];
$country = $_POST["country"];
$message = $_POST["message"];
// Definition of email that will be send follows
$to = 'yourname yourname@yourdomain.com>';
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: yourname yourname@yourdomain.com>' . "\r\n";
$headers .= 'Reply-To: yourmail@yourdomain.com' . "\r\n";
$subject = 'Your Subject';
$body = "


Name: $name $surname

Email: $email

Country: $country

Message: $message



";
// Mail command follows
mail($to, $subject, $body, $headers);
?>
4. Copy this script into a text editor and save as mailscript.php and upload to your server.
Done!
(Of course you need to adjust the blue fields. Also, my script was a bit more fancy, as I check for a valid email address and disable the button after submitting. If you are interested how I did that, please let me know.)
Now your Flash (SWF) file will pass the data entered into the SWF to the PHP script and send a mail via your server without any further user interaction or client-side mail program.

Enjoy!
Matthias

Locked

Return to “General authoring questions”